1 decade ago by Elvar
Hi fellow developers.
I am currently working on a Tower Defense game, here i got a map with a long road, this road got some turns on it, the creeps should spawn and follow the road to the end.
However i can't figure the approach for moving my creeps along the road, taking turns etc. first i thought maybe i could just tell the creep to move to x,x coordinates and then take a turn, then move to x.x and so on. So i tried just that, but could't find a method for moving a creep to a specific coordinate.
So i thought, maybe i set a collision tile on each turn, like a waypoint, then have a array of the directions traversing the array on collision. So i tried to implementing that, and it worked, but it did't. I got the creep to turn, but sadly it reached about 20 registered collisions at a waypoint, traversing the whole direction array, at just the first turn.
So this is hopefully where you tell me "you are doing it wrong" :-). How should i approach this?
Might also be worth noticing, that i'm currently novice @ impactJS, Box2d :-)
I am currently working on a Tower Defense game, here i got a map with a long road, this road got some turns on it, the creeps should spawn and follow the road to the end.
However i can't figure the approach for moving my creeps along the road, taking turns etc. first i thought maybe i could just tell the creep to move to x,x coordinates and then take a turn, then move to x.x and so on. So i tried just that, but could't find a method for moving a creep to a specific coordinate.
So i thought, maybe i set a collision tile on each turn, like a waypoint, then have a array of the directions traversing the array on collision. So i tried to implementing that, and it worked, but it did't. I got the creep to turn, but sadly it reached about 20 registered collisions at a waypoint, traversing the whole direction array, at just the first turn.
So this is hopefully where you tell me "you are doing it wrong" :-). How should i approach this?
Might also be worth noticing, that i'm currently novice @ impactJS, Box2d :-)