Propogation of upgrade in projectile based wepons
I am making a twin stick shooter.I has both raycast and object based wepons.I am making an upgrade system.For raycast based wepons.I have only one entity to update variables i.e the wepon itself. My question is how to approach the projectile based wepon as it has two entities - the wepon which throws the projectile and the projectile itself.Where should the damage and upgrade information should be ? If gun then, how will the projectile know how much damage to do ? If projectile then how upgrade information should be propogated to all the projectiles currently on the screen without slowing down the game. Also I am also trying to use pooling the projectiles.
Answer by sacredgeometry · Aug 21, 2019 at 04:33 PM
Well if your gun can fire different bullets then maybe it would be good to have the specification of the attack on the bullet but it doesn't really matter its more an implementation specific architectural problem than one with a "correct" answer.
You can pass a reference to the gun to the bullets or from the bullets to the gun. You could have a completely separate class that works as a message queue for all dealt damage.
The world is your oyster. I can give you an example of an attack implementation if it would help. I think I have one laying around from another question I answered.
It would be very helpful is you could provide an example.
I made you a waffly video ins$$anonymous$$d.
Video
Awesome video.Really appreciate the effort to explain the the concept.