Enemy 3 Shooting

This plane shoots heat-seeking bullets (following the main plane)

Heat seeking bullets

Obj: enemy3 bullet

Create a new object enemy3 bullet 

And a Create event...

  • Test Instance: are there any instances of the main plane object?
    object "myplane" > 0
  • Move Towards: If yes, then move the bullet towards the plane wherever it is - make sure you use your main plane's object name with ".x" and ".y" at the end...
  • Else
  • Vertical Speed: set to 8

Add an Outside Room event - have it destroy itself if it leaves the room.

Enemy 3 plane fires bullets

Go into the enemy3 plane object, into the Step event and add the following at the end:

  • Test Variable: if y less than 360
We don't want to have the enemy3 plane be able to shoot when it's below our main plane. It's hard enough to avoid the bullets as is. So we'll first test if the enemy3 plane is a bit above the score panel at the bottom. From the top of the room to the bottom = 480. The bottom score panel's height = 76 and the enemy3 plane's height = 32. So 480 - 76 - 32 = 372; so we'll use 360 to be safe, add a bit of an extra margin.

Inside Start & End blocks add:

  • set Chance to 50 (so less often than enemy2 bullets), and 
  • change the type of bullet for the Change Instance action to enemy3 bullet.

Main Plane hit by bullets

Go into your myplane object. Duplicate the Collision with enemy2 bullet event.

It will do the same thing as the other enemy bullet - lose health and destroy the enemy bullet.

Room

Go into your room. Now delete the enemy2 controller and replace with the enemy3 controller object. 

Test it out:

  • enemy 3 shoots at you, bullets coming towards the plane
  • does your health go down?