I am creating a minified NFL semi-simulation game. How am I able to draw a line as routes for each player for them to follow those?
Another problem I encountered is that whenever sprites/players are colliding each other they are stuck and do nothing but stop. I want them to get pushed for them to move again and continue chasing each other.
Thank you guys, this is my first time to use a licensed account here.
Develop games in your browser. Powerful, performant & highly capable.
I used a rather crude method in this experiment and it mostly works, even when the lines take bends and slight curves.
To see it working, left click to drop food and click the button to turn pheromones on and watch their behavior when an ant finds the food.
When an ant finds food it uses pathfinding to head back to the nest. As it travels, it creates a sprite on the layer under it (the red arrow) pointed in the direction it's travelling.
When another ant encounters the red arrow sprite (is overlapping) it turns to face the opposite direction that sprite is pointed in and moves in that direction, constantly checking to see if it is overlapping.
You can download the source at:
Checking sprite collisions or the 'is overlapping' should help solve your other problems.