well because of good people like Jezzticular, i've finally manage to get my enemy Ai moving to the different waypoints in my track. I'm realyy a newbie in programming and i just followed much of the code used in the Limit Rush tutorial. Right now i only have this big problem concerning the AI. i used this declaration
spot=1
main:
do
`get keyboard input for movement
if upkey()=1 then forward=1 else forward=0
if downkey()=1 then backward=1 else backward=0
if leftkey()=1 then left=1 else left=0
if rightkey()=1 then right=1 else right=0
`update the player
move_player(1,forward,backward,left,right)
control_player(2)
`update the camera
chase_cam(1)
gosub update_collision
sync
loop
i read all the data from a data statement and placed it above the DO LOOP
restore waypoints_positions
for spot=1 to 32
read xSpot#(spot)
read zSpot#(spot)
make object cube 50+spot, 3
position object 50+spot,xSpot#(spot),yPos#,zSpot#(spot)
`hide object 50+spot
next spot
i created boxes just to mark the waypoint and i used this to control the enemy AI
function control_player(id)
xPos#=int(object position x(id))
zPos#=int(object position z(id))
xSpot#(spot)=int(xSpot#(spot))
zSpot#(spot)=int(zSpot#(spot))
forward=1
if xPos#=xSpot#(spot) and zPos#=zSpot#(spot)
inc spot
if spot > 32 then spot=1
else
point object id,xSpot#(spot),object size y(id)/2,zSpot#(spot)
endif
move_player(id,forward,backward,left,right)
text 1,50,str$(spot)
endfunction
but the problem is, because i used integer values, my program detects the position twice and my SPOT gets incremeted twice also, thus, my AI moves to from point 1 to 3 without passing to 2. and also in the beginning of the program, my object goes to the 0,0,0 coordinates of the matrix before finally going to the next waypoint. can someone plz shed me some light?
phukol