I need to fastly change my object's color when cliked

Hello to everyone. I have a sprite with two frames in it. I am trying to make this sprite change frame while clicked and then rapidly change it back, kinda like in Minecraft when you kick some mob. To do this I made an event in which I set as conditions “button is down”; “cursor on object” and as actions “change animation frame of object: set to 1”; then I`ve created a sub-event in which conditions were “timer greater than 0.05” and actions “change animation frame of object: set to 0”. But the problem is that the first object spawned works correctly while all other objects of this type when spawned are not even clickable.

This is my first game, so I don’t really understand what to do with this stuff. How can I resolve this problem?

You don’t need those timers. Just make sure your object is an animated sprite and create 2 frames, one for the normal and one for the modified color. Change the duration or speed property according to your desire.

And for this, I think your problem is that you should use a “for each object” condition.

1 Like

It’s a for each event, not condition :wink:
The problem here is that the timer is used as condition Only when clicked as it is a sub condition, so the value of the timer is only checked when you reset the timer, so it would never happen. Tho it would be easier to make the other animation as long as you want it to stay and use an animation finished condition to make the sprite normal again.

Read the question again, it’s not about making it flash it’s about making it flash when clicked :wink:.

1 Like

Thank you guys, both @arthuro555 and @xJM27x =)

1 Like