- Home /
How to implement "layers" to a 2d tower defense game (c#)?
What I mean by this is take Bloons tower defense, for example. When the tower pops a balloon it goes to the next layer. Ex: If a tower pops a green balloon, it turns into a blue balloon, then if that is popped, it turns into a red balloon, then it will finally be popped. Here is an example: https://youtu.be/ZLLr0hjH_fM?t=471
I was thinking making a class or array for balloon, but i'm not sure how I can transform one balloon into another, and it is still a balloon class Any advice would be greatly appreciated.
Answer by mjboga29 · Nov 09, 2018 at 03:20 AM
Just do something like
if(Dart == Balloon) { GreenLayer.SetActive (false); BlueLayer.SetActive(true); }
Like put all layers on top of each-other, then turn the other ones off with the check-box in the editor, until only one is visible, then just toggle visibility when the dart hits it.
@mjboga29 What if I want to check what layer it's on? Should I use a float? or bool? If I use bools, that would be way too inconvenient.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How do i remove a list item from the scene while adding the next? 1 Answer
Multiple Cars not working 1 Answer
Trying to reset lvl on collsion 1 Answer