Object Follow Player Trick?

Blitz3D Forums/Blitz3D Programming/Object Follow Player Trick?

Caton(Posted March) [#1]
https://www.youtube.com/watch?v=B4Kmkxaysf4
starts at 0:46 to 1:00


Dan(Posted March) [#2]
That is pretty easy.

The monsters are aiming at the x,y coordinates of the player.

If they hit the wall, they stop.

this is the theoretical functioning code without the check for the walls:
if playerx>monsterx then monsterx=monsterx+monsterspeedx
if playerx<monsterx then monsterx=monsterx-monsterspeedx
if playery>monstery then monstery=monstery+monsterspeedy
if playery<monstery then monstery=monstery-monsterspeedy



here is an 2d example, for 3d you would render only the part of the playground array.