so i have this kind of idea of making some kind of tower defense game… but i cant get the “enemy” movement to go the “road” which is brown
this is what i have made so far http://prntscr.com/nvzesa
any suggestions?
so i have this kind of idea of making some kind of tower defense game… but i cant get the “enemy” movement to go the “road” which is brown
this is what i have made so far http://prntscr.com/nvzesa
any suggestions?
I think I have an idea of what to do, but I’m not certain if it’s what you want.
If you want to control the Square and lead it down the path, you could add “Barrier” objects around the path to make sure it can’t leave the “Road”. This is what would usually work for Top-Down games with paths.
Now, if you want the Enemy to go through the path on its own, then that’s a whole different story. It’s not that hard, just takes a little bit!
You can start by making “Checkpoints” thorough the Road for the enemies. No, not for Saving, but for changing the Force that’s driving the Enemy forward.
See where you drew those red squares? Those are the points the Checkpoints should be in - the curves, where the Enemy needs to “turn”.
At the beginning of the scene, add a Permanent Force with the “Trigger Once” condition to the Square in order to move it to the right down the path. Once it touches the checkpoint, use the action “Stop the object Square” and now add another Permanent Force, to a different direction, so it’ll make a “curve” and continue down the road.
The events should be something like:
If Square is in collision with Checkpoint (Trigger Once)
stop object Square
add to Square a permanent force, angle: 90 degrees and length: 150 pixels
Do that, but with different angles at different checkpoints so the Square will follow the Road.
Do that all thorough the Road. That way, the Enemy object should be able to go through it.
I hope this helps!