I place the monster into the game, and let it move to get the nearest target, after that I caculate the shortest path to the other target and get all the waypoint which the monster should pass! but the monster just go to the first nearest target when he was first placed into the map and he didnot move to new target!
the map like this
= =
29* = = *
= = = = = =
*33
= = = = = =
* = = *
= =
The monster will be placed on one of the 4 corners randomly
I think I probably make mistakes when I move the monster to his first nearest target,even it does move to the target but the code is strange
rem 29 means leftup target(4400,5750)
rem and here the monster will be placed from leftup corner(1,9999)
Do
...
if ABS(mX#-X(29))+ABS(mZ#-Z(29)) <8660
point object 3,4400,0,5750
move object 3,3
sync rate 60
if ABS(mX#-X(29))+ABS(mZ#-Z(29)) <50
position object 3,4400,0,5750
rem this will draw a line in the radar
ink rgb(255,0,0),rgb(0,0,0)
line 0,0,44,42.5
rem till now it works fine(strange code)
rem after moved to the first nearest target 29
rem _path1 will calculate the shortest path to the center target 33
gosub _path1
endif
endif
...
sync
loop
_path1:
some pathfiding calculating..
got the waypoint the monster should go
move to center target via waypoints.----this make me headache!
return
For exmaple, if I got the waypoint from leftup target to center target,
if 29=leftup target, 33=center target, and from 29 to 33, it need to go 30,31,32,three waypoints, I know all the coordinates of them.
how to move the monster from one point to the other point and draw the line in the radar at same time until he get the center target?
I think I even donot know how to move a object! Damn!