Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

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 :-)

1 decade ago by Elvar

Posted in wrong forum, my apologies.

1 decade ago by alexandre

I haven't tried what I am about to say, and my opinion is skewed by what I recently played with: local gravity, aka, local attractors. Anyway here's what I would do:

1. create an EntityWaypoint class
2. then, spawn as many waypoints as you need and store them in an array
3. tell each selected unit to target the first waypoint in the array
4. at each update, units that have a target receive a force in direction of that target
5. when check is called on an entity, it immediately targets the next waypoint
6. when the last waypoint has been reached, set target to null

1 decade ago by Elvar

Thank you for your reply Alexandre, however i did actually get it to work, using collisions, have a look http://dev11.reload.dk/blomster/

Notice, that version only works in Google Chrome :-).

1 decade ago by alexandre

Sounds right, Elvar.

BTW, your demo is unbaked. You should remedy that asap.

1 decade ago by yolanda89

awesome
this is also a good game site
http://www.rs.farmer100.com

1 decade ago by alexandre

Someone kick this perv out.
Page 1 of 1
« first « previous next › last »