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

Terry Reedy tjreedy at udel.edu
Sun Mar 21 23:00:59 CET 2010


On 3/21/2010 3:23 AM, Ren Wenshan wrote:
> 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




More information about the Python-list mailing list