Changing a Sprite When Hit in GameMaker

Posted by Pixels_ on Game Development See other posts from Game Development or by Pixels_
Published on 2014-05-08T02:17:11Z Indexed on 2014/08/20 10:35 UTC
Read the original article Hit count: 179

Filed under:
|
|

I am making a simple little Galaga style game. I want the objects sprite to change whenever it is hit.

For example if a laser hits an alien then the sprite takes 1 out of 4 damage to its health points (HP). However I want the sprite to change from green to yellow after 1 hit, yellow to orange after 2 hits, orange to red after 3 hits, and red to pixel explosion after all 4 HPs are lost. That way you can easily distinguish the amount of health each alien has left.

How can I do this? Preferably explain it in code.

© Game Development or respective owner

Related posts about sprites

Related posts about programming