Enemies hit by bullets

If the enemy plane is hit by a bullet, then the enemy plane should be destroyed.

Obj: explosion1

Create a new object explosion1. The only thing we need to do is add an Animation End event so that once the explosion animation has played, it destroys itself. 

enemy 1 hit by bullet

Obj: bullet

Go into your bullet object and add the following event:

  • Collision with enemy1
    • Play Sound: explosion1
    • Destroy Instance: (self = the bullet)
    • Create Instance: set to 'other' (so enemy1 plane turns into explosion, in the same place as the enemy plane)
      object = explosion1, (0,0), relative
    • Destroy Instance (other =enemy1 plane)
    • Set Score: give the player 5 points, make sure relative

Test it out - if you hit your enemy1 plane with a bullet:

  • does the bullet disappear
  • does the enemy plane explode/disappear?

enemy 2 hit by bullet

Still in the bullet object

  • Right-click on the Collision with enemy1 event and duplicate it to get the Collision with enemy2 event 
  • change Set Score so player gets more points for shooting this plane since it will be harder to hit later on - set to 10 points

enemy 3 hit by bullet

  • Right-click on either Collision with enemy 1 or 2 event and duplicate for Collision with enemy3
  • give the player 20 points for hitting this enemy plane

Test it out - you should now be able to hit all the enemy planes.