Step 5: X-Wing Hit Animation 1

Goal:


In a video game, you always want to give your players as much information about what is happening to their character on screen as possible. Maybe that means a sound that plays when they collect items, an animation that plays when they use their weapon, or a score counter in the upper corner.

We need to add a way for the player to know whether or not they have been hit. This will be done by having the X-Wing perform a flashing animation after being hit. This has the added bonus of giving you a few frames of invincibility while it’s happening.

Steps:

  1. From Events, place a when I receive block.
  2. Click the menu and select “New message”.
  3. In the window that appears, type “Hit”.
  4. From Control, place a repeat block and set it to 5.

Code: