Weapon System

 Author: Daniel Jackson

I took the lead on creating the weapon systems for our game, that includes all the weapons the player and enemies could ever possibly use. When I took on the task we only had a very simple click and spawn bullet system and it was my job to take that and turn it into each of our guns and make them feel distinct from each other. The major issue with this was that for one no weapons existed yet so everything had to be done from scratch, the bullet class that was in use didn't have enough information to perform any gun specific tasks (such as an explosion), and even if bullets did have the correct gun information attached to them, we weren't handling the bullets at all until a collision with something.

First thing I had to do was create a weapons class. This held an enum that had the gun types, and every possible weapon with its associated stats as well as a way to retrieve and set said stats. Then using that information I how the bullets were spawned when they entered the world (such as the shotgun firing multiple bullets at once). Then I moved on to the bullets themselves and away from the weapons. I gave each bullet a 'lifetime' which once exceeded would despawn the bullet instead of it travelling forever until a collision. Then I changed the bullet construction to take in the weapon that fired it so I would know if the bullet would need to perform any special effects.


image: Weapons class that holds different properties for each weapon.

image: Demonstration of simple explosion using debug lines
image: Shotgun firing multiple projectiles at once





Comments

Popular posts from this blog

Adding assets to every enemy -- Owen Meyers

Sphere to AABB collision