Reputation: 2552
I have a sprite in andEngine. All I want to do is to rotate it on a certain angle again and again. Now the problem is that when I rotate the sprite it only changes it angle. But I want to rotate it in a sequence. For example if my current angle is zero and next angle is 180. Then the sprite should move like this 0 1 2 3 4 5 6 7 8 9 10...180. I hope I cleared my question. I think there is something like this in andEngine like
new RotationModifier(
10, // duration
0, // angle start
-360 // angle end
)
But I dont know how to use it in my class which is extended my Sprite class.
Upvotes: 2
Views: 3809
Reputation: 2790
Every 'Entity' (where Sprite is a subclass of), has the method registerEntityModifier(IEntityModifier).
Modifiers can be nested (kind of like InputStreams), so you might want to look into LoopEntityModifier, SequenceEntityModifier and ParallelEntityModifier.
Upvotes: 4