Firing at and Following Player

AngelDog

  • Posts: 37
I'm making a platformer game, and I want the enemies to fire at the player. I'm using the follow target behavior once the player comes on screen, but I don't know how to get them to start firing at the player. There's also one problem with the follow target, which is the enemy is affected by gravity but when they start following the player they just float towards you.
beep bop

JeffreyDriver

  • Posts: 2262
If I remember correctly, the Follow  Target behaviour is for top-down games, not side-view/platformers (unless you want floating enemies). You'd be best off creating your own behaviours for this.  As your game is a platformer, you want enemies to stop walking if there's either a tile, or end of a platform in the way. You can use the tile API to check for this.

There are block to let you check if an actor is on screen. So you can check if the enemy and the player are on screen. If so, trigger a custom event that shoots towards the player. Let's say you want an enemy to shoot every two seconds, get the custom event to trigger itself again after two seconds, if both actors are still on screen.