How to keep effects of image filters going for some seconds?

R

Ren Wenshan

Hello, every pythoner.

Firstly, I want to mention that English is my second language, so
maybe there are some sentences which makes you confused, sorry.

I have been learning Panda3D, an open source 3D engine, these days.
Now, I'm trying to write a small game for fun and practice. However,
I've ran into a problem.

I want to make some speical effects and there is my code:

def ventose(self):

global potato_HP

if potato_HP[0] == 1 and potato_HP[1] == 0:
if random() > .30:
self.filters.setCartoonInk(separation = 0.8)
self.robotVincent.resetHead.start()
self.decreaseVincentHP()
Wait(3)
self.fliters.delCartoonInk()

However, it doesn't work, the CartoonInk effect will never been shown
in my game and I don't want my game to wait three seconds, what I need
is to keep the effect for a period of time while the game run as well.

Besides that, I also want to show a counting back like "3", then "2",
then "1", finally "Go".

As a beginner, I don't know how to do them properly.

Please give me some directions, thank you.
 
T

Terry Reedy

Hello, every pythoner.

Firstly, I want to mention that English is my second language, so
maybe there are some sentences which makes you confused, sorry.

I have been learning Panda3D, an open source 3D engine, these days.
Now, I'm trying to write a small game for fun and practice. However,
I've ran into a problem.

I want to make some speical effects and there is my code:

def ventose(self):

global potato_HP

if potato_HP[0] == 1 and potato_HP[1] == 0:
if random()> .30:
self.filters.setCartoonInk(separation = 0.8)
self.robotVincent.resetHead.start()
self.decreaseVincentHP()
Wait(3)
self.fliters.delCartoonInk()

However, it doesn't work, the CartoonInk effect will never been shown
in my game and I don't want my game to wait three seconds, what I need
is to keep the effect for a period of time while the game run as well.

The generic answer is to turn CartoonInk on and set a timed event for
now+ 3 secs to turn it off. You will have to understand how to interact
with the Panda event loop. For a more specific answer, follow Donn's
advice -- Panda forum. I know there was one when I looked at Panda a
year ago.
Besides that, I also want to show a counting back like "3", then "2",
then "1", finally "Go".

Ok, instead to events set 1 sec in future.

Terry Jan Reedy
 
V

Vincent Ren

Hello, every pythoner.
Firstly, I want to mention that English is my second language, so
maybe there are some sentences which makes you confused, sorry.
I have been learning Panda3D, an open source 3D engine, these days.
Now, I'm trying to write a small game for fun and practice. However,
I've ran into a problem.
I want to make some speicaleffectsand there is my code:
def ventose(self):
     global potato_HP
     if potato_HP[0] == 1 and potato_HP[1] == 0:
     if random()>  .30:
         self.filters.setCartoonInk(separation = 0.8)
         self.robotVincent.resetHead.start()
         self.decreaseVincentHP()
             Wait(3)
             self.fliters.delCartoonInk()
However, it doesn't work, the CartoonInk effect will never been shown
in my game and I don't want my game to wait three seconds, what I need
is tokeepthe effect for a period of time while the game run as well.

The generic answer is to turn CartoonInk on and set a timed event for
now+ 3 secs to turn it off. You will have to understand how to interact
with the Panda event loop. For a more specific answer, follow Donn's
advice -- Panda forum. I know there was one when I looked at Panda a
year ago.
Besides that, I also want to show a counting back like "3", then "2",
then "1", finally "Go".

Ok, instead to events set 1 sec in future.

Terry Jan Reedy

thx, I've sloved my proble with doMethodLater()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top