Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

2 views
Skip to first unread message

Ren Wenshan

unread,
Mar 21, 2010, 3:23:26 AM3/21/10
to
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.


-----------------------------
Vincent Ren

donn

unread,
Mar 21, 2010, 7:08:07 AM3/21/10
to pytho...@python.org
On 21/03/2010 09:23, Ren Wenshan wrote:
> I have been learning Panda3D, an open source 3D engine,
Ask on the Panda3D forums, you will get good help there.

\d

Terry Reedy

unread,
Mar 21, 2010, 6:00:59 PM3/21/10
to pytho...@python.org
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

Vincent Ren

unread,
Apr 4, 2010, 12:13:31 AM4/4/10
to
On Mar 22, 6:00 am, Terry Reedy <tjre...@udel.edu> wrote:
> 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 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()

0 new messages