• About
  • Games
  • Asset Packs
  • 3D Art
  • Environments
  • Game Studies
  • Blog
Stefan Dolidis
  • About
  • Games
  • Asset Packs
  • 3D Art
  • Environments
  • Game Studies
  • Blog
Stefan Dolidis

2. FPS GAME - WEAPONS

17/1/2022
Picture
The player's arsenal.
The idea was for the player to have 9 weapons in total, one for each number on the keyboard (except for the 0 key 🙁). But then, thinking about it, it felt unnecessary and bloated and would be harder to make them all useful without the next weapon making the previous obsolete. So I cut it down to 7, and then 6. I want the player to use all weapons in the game, not just one or two, where they just keep switching to their favourites. Helping with that is the amount of max ammo the guns are going to have as well as the amount of ammo pickups in the world. Every weapon in the game can also be upgraded/leveled up. So only using one weapon in the game can really make the game more difficult for the player in later levels.
Picture
Each weapon starts at level 1 and their max level is level 5 (TBD - might shorten it to 3). Haven't decided what makes your gun level up yet. Initial thinking was that it just counts the enemies you've killed with each gun, and based on that it will level up at a certain amount of kills. The weapon's damage, fire rate, and enemy hit chance increase with each level.
I've created tables in Microsoft Excel for each weapon that stores their level values that is read by a script in the unity editor (and in-game). This makes it much easier for me to edit and tweak individual values at anytime.
Picture
Weapon Stats Table
Each weapon also carries a set of values that modify a Box Collider that is used to check if the player's attack has hit an enemy. So if an enemy is inside the box collider and nothing is blocking the player from attacking the enemy, then the player's attack hits the enemy!

​Some weapons may use this box collider to aim at enemies. For instance, the player shoot a fireball, which is a projectile, if the enemy is in the collider, then the projectiles direction will be where the enemy is in the world, and move towards that.
Picture
Spear Idle sprite
Picture
Spear Stab sprite
Weapon sprites were all made in Photoshop, with the help of a Wacom Pen & Tablet. Took photos of myself (my hands 👐) holding placeholder objects as reference. The spear was a roll of Christmas wrapping paper! 🎅🎁
​
When an enemy walks into the Player Attack Box Collider, the enemy is added to a list that keeps track of every enemy in that collider. So if the player shoots the shotgun, it gets all enemies in the collider and damages all of them. The shotgun's damage is also higher when the enemy is closer than half of the Player Attack Collider size (closer to player), otherwise its the damage output is low. If you use the Spear, it only damages the enemy that is closest to the player (only one enemy at a time).
Picture
Picture
I still need to code the weapon hit/miss chance when attacking. So far, if the enemy is in the attack box collider, and the player attacks, it hits the enemy 100% of the time. Might be interesting if there's a chance you can miss as well.
​
The weapon attacks are all controlled by one script (a script called WeaponAttack.cs). So far, I have created 3 of the weapons. Fists, Spear, and Shotgun (there was a Dagger, but it was replace by the Spear). The Fists and Spear use the same bit of code that's under the function called MeleeAttack(). It attacks one enemy at a time. The Spear has a greater reach. The Shotgun uses a function called SpreadShot() in the same class.
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Archives

    May 2022
    January 2022
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    November 2020
    October 2020
    March 2020
    February 2020
    December 2019
    November 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    October 2018
    September 2018

    Categories

    All
    Coding
    Development
    Games Life
    Game Studies
    Old Blog

    RSS Feed

© ​Stefan Dolidis