Rotate sprite 90 180 270 360

Hi to all, thank you, I’m still new in this software but manage to make some progress. Regardig this I have looking around the forum but have not gotten a proper solution or if there is I do not know it.

I am looking to rotate sprite when doing click on it: 90 180 270 360. I have tried this:

but insted of going one by one, it jums straight to 180, like this:

sprite

I do not know if there is a way to get the sprite 90 and then 180 and so on…any help appreciate it… i will continue working on it, thank you !

You have a few options, but before we go over that you will want to ensure you review how events work. I recommend checking out the first few tutorials here: GDevelop 5 tutorials [GDevelop wiki]

At a high level, all events (conditions and actions) are evaluated every frame.

This means your current events say “When the mouse button is released, change to 90, then immediately change to 180”.

You will need to rethink how you’re deciding when to rotate. I’d probably recommend using an object variable instead, then use “left mouse button was pressed” instead of released, add a trigger once condition, and then add a sub event. In the sub event, check the value of object variable, if it’s less than 3, increase it by 1. If it’s 3, reset it to 0.

Then you have an entirely separate event that checks the object variable, and sets the rotation based off that variable (e.g. if object variable is 0, set angle to 0. If it’s 1, set angle to 90, etc. Ensure you have trigger once as a condition as well)