Laser

 Author: Daniel Jackson

The laser is the final weapon we needed to be finished with all of the base weapon systems. However, because it behaves completely differently from all of our other weapons it needed its own system to function properly. The player firing it, its construction, and its collision checks all had to be built from scratch using different functions for each. 

For this, I created a new class for the laser itself to handle its construction. I limited the player only being allowed access to one laser at a time and constructed one if the player had no laser assigned to them. If they did the laser would grow in size (assuming it's maximum radius hadn't already been reached). The collision acts as a raycast from the one firing it, forward until it hits a wall. After which, it constructs a capsule stretching from the start point to wherever on a wall the collision was registered with the current radius of the laser. If an enemy is within the bounds of the capsule damage is delt to said enemy. If the player runs out of ammo at any point (or the button is released) the laser decreases down to nothing, is deleted from the world, the removed from the player.



Comments

Popular posts from this blog

Adding assets to every enemy -- Owen Meyers

Sphere to AABB collision