It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I've been working on the tower defense tutorial, and everything works as it is. But I'm trying to use the waypoint script to get my enemies to make a random choice of following a different set of waypoints. (I.E. when the enemy spawns, it either follows path 1 or path 2) Any thoughts on this?
Comments
Greetings,
Sounds like a great modification to make! Where are you at with this and are you stuck on any certain part/point?
Keep on Creating!
Justin of JustinTime Studios (http://unity3d.expert)
Hi,
I have tried putting the waypoints inside an array of arrays. But I couldn't work out how to set it up the array properly, or reference it properly either.
I'm not even sure if this is the best way to go about it in the first place lol.
Hi, try this. Start organizing your waypoints in a hierarchy. E.g. WP1 (empty game object) as the set of the first path and WP2 for the second etc.
Remove the concept of an explicit start point and use the first waypoint in the sets as the start point.
Therefore, you must adjust a couple of things.
Wave.cs:
Add
Then you can indicate which waypoint set a wave should spawn/use.
WaveSpawner.cs:
Change
public Transform spawnPoint;
to
private Transform spawnPoint;
We will set the spawnPoint to the first waypoint in the used waypoint set.
Add
Waypoints.cs
Change it to
Thats it, enjoy and have fun.
Btw. is it possible to format the post in a more code sstyle?
Menith haha yeah its possible you just need to click on the paragraph sign left to the text you are typing then go on the quote sign and select code block
@daniel thx a lot. I just tried it out and it worked perfectly.
Wow @Menith Thanks a lot. This is exactly what I was trying to do. I just couldn't work it out.
I still have a problem though. Because I have made quite a few other changes the game. I have changed it so the waves can spawn early, and now if the next wave spawns, the current enemies on the field will change over to the new waypoints.
Hi Brackeys, thanks for the awesome tutorials, am learning new stuff everyday,i have a issue and struck with it for days, am doing a Tower defense game with isometric tile, i went thru tower defense tutorial(done in 3D) for learning, but am doing a with 2D sprites, i some how figured out the character movement in way points, but my enemy character has different movement sprites , i dont how to call the respective sprites when character is turning on right or left. The tutorial above is written in Player perspective with Key inputs, but i just want the Enemy spawning in a waypoints with moving on respective direction sprites. can u please refer any tutorial.Thanks a Lot.
Hi all, I don't know if this forum is still active, but I need some help I got to ep 10 then I realized my turrets when placed on a node it will sit above the node so I tried the offset nothing still in the air then I put 100 ,100 ,100 in the offset to see if it is working nothing still in the same place and the same height as it was before. So, then I reimported the models to see if that will work no, they're stuck in the node now and offset does not fix it the script is the same as Brackyes the turret and missile turret are my own models they have not been orientated right when exported but I made sure the partToRotate is facing the right way and other empty game object is facing the right way (muzzle flash, Fire Point and the empty game object containing all the this stuff) please help I got so far now I'm puzzled.