Tower defense: Being able to put out multiple turrets

0

Stats

2,194 visits, 2,911 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 11 Nov, 2013. Last updated 19 Feb, 2019

Okay so i just wanted to make a short tutorial covering this specific subject since i have been trying to figure it out for a long time and finally solved it a few days ago. My writing and grammar might be kinda halfbad, but bear with me. This might also not be the smoothest or easiest way to do this, but it was how i figured it out and if you have any tips on how to make it easier, feel free to tell me in the comments.

Okay, so what we want to do is to have multiple turrets to buy and put down on our defensegrid. We need to make sure that these turrets are somehow seperated once we click and choose them so that we dont put down all the turrets we have available at once or we cant switch between turrets and are only able to pick one.

To do this you make a global variable for each turret you have like this:

And then you make a on object clicked event that sets the corresponding turrets variable to 1 when it is clicked, and sets all other turrets variables to 0. Like this:

This is to make sure that only the turrets that have their global variable set to 1 gets put down when you pick them.

After that you make another on object click event (or whatever event you have to set down turrets) that makes sure that the turrets variable is set to 1 and then puts it down. You will then copy this event and just add another turret to it, 1 event for every turret you want to be able to buy. Like this:

And then just the exact same event but with another turret attached to it.

And thats it! All you gotta do. Leave a comment below and tell me what you think. Good luck with creating your games and i hope this tutorial was of any good to you! :)

  • 0 Comments

Want to leave a comment? Login or Register an account!