how does an enemy move to the players direction - not following him?
mhmma
Member Posts: 5
I have a bat enemy which attacks the player when the player is near it. Is it possible that the bat moves in a direction to the player but not to the players X and Y position - not the MOVE TO POINT behavior because than it follows the player all the time the bat only should fly in the direction to the player so the player is able to avoid the enemy.
(sorry for my bad english hope everything makes sense)
(sorry for my bad english hope everything makes sense)
Answers
Then create a rule that say, when the ENEMY SPAWN set TRIGGER to TRUE.
Then Create a rule in the player that says when TRIGGER is true, change attribute, Player X to Self.Postion X. Do the same thing for the Y position.
That should work
to get an angle for the direction towards the player you have to do this
make a rule if game.player.x is < self.position.x
then use the move behavior and in direction insert:
atan((game.player.y-self.position.y)/(game.player.x-self.position.x))+180
and if game.player.x is > self.position.x
atan((game.player.y-self.position.y)/(game.player.x-self.position.x))
then just use some triggers so that the enemy just gets the angle once and the bat flies in the correct angle (direction) towards the player and dont stops at the players coordinates