Creeps got stuck - what can i do ?
Bernd16K last edited by
Some of my creeps got stuck at a small corridor.
What can i do to move them further.
Seems like they are blocking each other.
Davaned last edited by
Link/picture? Hard to tell what you mean. In general, you can have creeps swap locations by having them move at each other.
deft-code last edited by
Creeps can move past each other, but
Creep.moveTowill not try to by default. The simplest solution is adding the
ignoreCreepsoption, but that has other other disadvantages. Traveler.js is a good example of improving on
moveTo. You can use it as is, fork it as a starting point for your own movement code, or as inspiration for your own.
Smokeman last edited by
I suspect this is him here. Creeps cannot be on the same tile at the same time. That's really their only rule in this regard.
Your first problem is the creeps that got energy from the source aren't trying to move away from the source. Make them move! If you don't use same variant of move (Like 'moveTo(destination);') it won't try to continue it's journey.
your second problem is you have way too many creeps in there. Make less creeps! With less creeps, it will be more clear why they aren't moving away from the source.
Creeps swapping places: What actually happens is each creep jumps from tile to tile, like a chess piece.They don't have a 'collision radius' and propagate from place to place. If the move was probably legit when the creep.move(dir); (It always distills down to that call.) call was made, it returns '0' and registers the 'intent' to jump to that tile. If the simulation can move the creeps when it runs, the creeps jump to the next tile. On the client, they are moved smoothly around, so it looks like they go through each other.