sync on : sync rate 0 : make camera 1 : backdrop on 1 : color backdrop 1, 0
make matrix 1, 10000,10000,50,50 : randomize matrix 1, 100 : update matrix 1
make object sphere 1, 50 : position object 1, 100,25,100
dim vel(100)
for enemy=2001 to 2100
make object box enemy, 50,100,50
color object enemy, RGB(rnd(250),rnd(250),rnd(250))
position object enemy, rnd(9000)+500,50,rnd(9000)+500
vel(enemy-2000)=rnd(8)+1
next i
DO
if (upKey()=1) THEN move object 1, 10
if (downKey()=1) THEN move object 1, 5
if (rightKey()=1) THEN yrotate object 1, wrapValue(object angle y(1)+5)
if (leftKey()=1) THEN yrotate object 1, wrapValue(object angle y(1)-5)
x#=object position x(1) : z#=object position z(1) : y#=get ground height(1,x#,z#)+25
position object 1, x#,y#,z#
for enemy=2001 to 2100
xe#=object position x(enemy) : ye#=object position y(enemy) : ze#=object position z(enemy)
if (sqrt((xe#-x#)^2 + (xe#-x#)^2 + (xe#-x#)^2) < 40)
move object enemy, 0
else if (sqrt((xe#-x#)^2 + (ye#-y#)^2 + (ze#-z#)^2) < 700)
point object enemy, x#,y#,z#
move object enemy, vel(enemy-2000)
else if (sqrt((xe#-x#)^2 + (ye#-y#)^2 + (ze#-z#)^2) < 900)
point object enemy, x#,y#,z#
endif
endif
endif
xe#=object position x(enemy) : ze#=object position z(enemy) : ye#=get ground height(1,xe#,ze#)+50
position object enemy, xe#,ye#,ze#
next enemy
position camera 1, x#,y#+100,z#-300 : point camera 1, x#,y#+50,z#
sync
LOOP
figure this code out..
not difficult.. I think you did forget to point the objects when
they are inside the condition for to be moving... so.. when they can
move to main character's position, they stop pointing properly
to it..
Programming logic hint:
The first condition is: enemy must to stop? If doesn't, then
can it move? If yes, then move AND point to character.. If can't
move, so.. can it just point to object?
Ok.. you follow the logic you think it's easier for you..
But I hope that the code above helps..
(ignore that array.. I declared that just for setting up different
speeds to enemies (trying to get rid of those ugly 2 or more enemies' "fusions"))..
ok... blah blah blah
just enjoy
The worst foe lies within the self...