I came to this:
id seq = [Sequence actions: [RotateBy actionWithDuration: timetocomplete angle:180], nil];
id rep = [RepeatForever actionWithAction:seq];
[Sprite runAction:rep];
Any better way or anything to consider?
Thanks
A fast, easy to use, free, and community supported 2D game engine
I came to this:
id seq = [Sequence actions: [RotateBy actionWithDuration: timetocomplete angle:180], nil];
id rep = [RepeatForever actionWithAction:seq];
[Sprite runAction:rep];
Any better way or anything to consider?
Thanks
Hecks .. dam with the no edit post feature.
Can anyone correct the tittle to:
Rotating a Sprite indefinitely
You want it to rotate whole 360 not 180, right?
id actionRotate = [RotateBy actionWithDuration: timetocomplete angle:360];
id actionRepeat = [RepeatForever actionWithAction:actionRotate];
[Sprite runAction:actionRepeat];
I am not at computer right now so I can't test it, but there is a possibility that you'll see a small glitch when Sprite completes full 360, until it starts new rotation. If that's the case, then simply add more rotations in the first place so you don't see sprite finishing the rotation at all, for example:
id actionRotate = [RotateBy actionWithDuration: timetocomplete*1000 angle:360*1000];
Then you maybe don't need the RepeatForever method at all, depending on how long your scene exists :)
crmagicxxx is correct.
Here's the code I used:
'id RotAction = [RotateBy actionWithDuration:12 angle:360];
id RepeatAction = [RepeatForever actionWithAction: RotAction];
[ship runAction: RepeatAction];'
Using this code, the ship achieves a 360 rotation w/in 12 seconds and does it indefinitely. Hope this helps! :)
Thanks
Is a bt mre compact than mine.
I do this in the GameLayer init but now when I call director pause they still cotinues rotating! ...
Forget what I said regarding the pause.
You must log in to post.