Hi guys, here's a hard one :
I'm trying to create a Tower Defense game.
Currently, I have only one type of turret possible, the basic gun turret with a turret behavior, which shoots bullets with a bullet behavior. So far so good.
As in 99% of Tower defense games, you may place more than one of the same turret type, right ? Right.
But I also would like to be able to upgrade my turrets individually, and not all the same turrets of the same type at once.
So I have to create a container with all upgrade buttons I have, and associate them with my tower, to make each same upgrade buttons associated with their own tower, and all distinct from each others, right ?
This way, every single tower (of the same type) will have its own upgrade options, and their variables will be independent too (range, speed, power, etc...)
Now comes the hard part : The only way I can think of to upgrade bullet power is to set a variable somewhere (supposedly inside the bullet) that reduces the enemies life by the value of that variable, which represent the damage the bullet does. Which mean I need the bullets to be in the same containers as the turrets, because if not, every single bullet is gonna share a single power variable, and upgrading towers individually will work, but not for bullet power, because turret firepower is not relative to the tower, but to its bullet. (stop me if i'm wrong so far)
BUT ! If I include bullets in the same container as the turret, then the turret is gonna be destroyed as soon as the bullet gets destroyed/another turret may spawn when a turret shoots (spawns) a bullet...
So I am cornered. No way to make bullets separate from each other in properties without including the tower they originate from in the same container, which creates various problems.
So here is the question : How do I make my bullets make a certain amount of damage to enemies , depending of which tower they have been fired from ?
Good luck.... And thank you very much to anyone who will try to help