I’m building a tower defense game, and I want to build an array to hold my pawns which I can spawn and control during the game.
I’m trying to build an array that holds all of my towers so I can just go to my array whenever I need to spawn a tower.
I have a class deriving from the APawn class called ATower, and I have my actual towers inheriting from the ATower class.
I have this array set up:
.h:
TArray TowerArray;
Then in my constructor: (.cpp)
//ATower_Archer is a class derived from ATower
ATower_Archer* archer = Cast(//what to put here);
Then I want to add this reference into an array:
TowerArray.Add(archer);
Also if anyone has any tips on a better way to do this feel free to help me out. You can probably tell I have no clue what I’m doing.