mjohnsonengr / mini-intruders

Space invaders clone
1 stars 0 forks source link

Firing System #12

Open mjohnsonengr opened 8 years ago

mjohnsonengr commented 8 years ago

For now I am implementing a basic firing system for the player.

I would like to have configurable player and enemy firing systems. This would allow the player to receive weapon upgrades that allow him to fire better ammo and fire at different speeds. This would also allow the enemies to progressively get more difficult on each level by firing faster, more, and with better ammo.

In order to do this, I propose giving the Weapon class a FiringPattern; this firing pattern would be configurable. The FiringPattern would keep track of any variables it needs to in order to decide when it is appropriate to fire. The weapon would then check with the FiringPattern to see if it's okay to fire, and after firing, would alert the FiringPattern so the FiringPattern can keep track of when the last shot was.

In this scenario, input would still be passed to the Weapon who would keep track of a "firing" state. If the Weapon is currently firing, it will check with the FiringPattern to see if and when it is able to spit out another bullet.

mjohnsonengr commented 8 years ago

The end goal could be just as easily accomplished by simply creating separate Weapons; e.g. for now I only have a BasicUpWeapon -- this could be expanded soon.