Enemy Boss AI help

Hi, I made a 2D shooting platformer game.

My normal enemies just spawn randomly and come towards me with an instant force. On collision, the player losses health so the player needs to shoot before it collides.

Now I want to create a boss. I want him to fly around my player and shoot. How to make the boss shoot the player. How to get the players position. The player will be moving to avoid the bullets so how to make the boss shoot the player.

Move Boss towards Variable(roam); Variable(roamy)
Player is Flipped(inverted), Variable roam = Player.X()+RandomInRange(somenum, anynumber)
Player is Flipped, Variable roam = Player.X() + RandomInRange(somenum, sameanynumber)
Variable roamy = Player.Y()-RandomInRange(somenum, anynumber)

Timer shoot of boss is greater than 0.8 then
Create EnemyBullet
In a child Event
If Key pressing “left” then
Add a force to EnemyBullet towards PlayerX()+8, Player.Y()
If Key pressing “right” then
Add a force to EnemyBullet towards Player.X() - 8, Player.Y()

Making something like this may help.

1 Like