On Mon, 2010-06-21 at 01:00 -0300, claudio canepa wrote: > On Sun, Jun 20, 2010 at 3:01 PM, Ivo Fokkema <[email protected]> > wrote: > Hi guys, > > I've been getting frustrated for a couple of hours now on > trying to > get to start a repeated sequence after a certain delay. > What I would want, is something that resembles smoke coming > from a > certain point on the screen. I was thinking to create a > certain number > of reusable sprites, which fade out and move away slowly for a > couple > of seconds, and then I want to place them back in the > beginning, fade > in, and restart the sequence. Something like: > > def SmokeFadeOut(): > return(MoveBy((-150, 0), 4) | FadeOut(4) | ScaleTo(3, 4)) > def SmokeRestart(): > return(MoveBy((150, 0), 0) | FadeIn(0) | ScaleTo(1, 0)) > def SmokeFade(delay): > return(Delay(delay) + Repeat(SmokeFadeOut() + > SmokeRestart())) > > for i in range(0, 5): > smoke = cocos.sprite.Sprite('smoke.png') > sprite.add(smoke) > smoke.do(SmokeFade(i)) > > But cocos is throwing an exeption: "You can only sequence > actions with > finite duration, not repeats or others like that" > Why? I can't see the reason. I've been trying to work around > it, but > none of the solutions I thought of, work. Do you guys have any > suggestions? > > Thanks in advance! > > Ivo Fokkema, Netherlands > > > > > This was the cocos 0.3.0 behavior, in current svn trunk that type of > restrictions has been eliminated. You can use the svn version, it is > in good shape. > > > Also, for an alternative way on smoke, look at the example in > test\test_particle_smoke.py ( in the trunk of svn repo), and the other > particle examples. > > > Probably you know this, but anyway the svn repo and web interface can > be reached at > http://code.google.com/p/los-cocos/source/checkout >
Hi Claudio, Thanks for your fast response! The latest svn release does solve this problem, but it introduces a new problem: In the following code, the first MoveBy() does not get executed: sprite.do(Delay(0) + MoveBy((-65, 0), 0) + Repeat(MoveBy((0,10), 1))) However, when I insert a Delay > 0: sprite.do(Delay(0.1) + MoveBy((-65, 0), 0) + Repeat(MoveBy((0,10), 1))) It does get executed. So I can circumvent this problem, by adding a tiny delay, but if you have time I would appreciate it if you could look at what going wrong. The sprite is a child of another sprite, not sure if that matters or not. Thanks! Ivo -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
