Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualTournicoti

Posted 03 November 2012 - 03:11 AM

To make the enemy follow the player you can do something like that :

1) Compute the direction the enemy must follow :
direction = normalize ( player - enemy )

2) Compute the new enemy position, according to some velocity :
enemy = enemy + direction * velocity

where :
direction, enemy, player are 2D vectors
velocity is a scalar

Hope it helps Posted Image

#1Tournicoti

Posted 03 November 2012 - 03:09 AM

To make the enemy follow the player you can do something like that :

1) Compute the direction the enemy must follow :
direction = normalize(player-enemy)

2) Compute the new enemy position, according to some velocity :
enemy = enemy + direction * velocity

where :
direction, enemy, player are 2D vectors
velocity is a scalar

Hope it helps Posted Image

PARTNERS