Weapon Types - UQcsse3200/2024-studio-1 GitHub Wiki
Weapon Types
Introduction
This documentation provides an overview of the different weapon types used in the game. Weapons are configured using the WeaponConfig
class, which loads weapon data and provides details about each weapon type, including its damage, range, fire rate, ammo, and other properties.
Weapon Categories
Weapons are divided into two main categories:
- Ranged Weapons: Weapons that have ammunition and can be fired from a distance.
- Melee Weapons: Weapons that do not use ammunition and are designed for close-range combat.
Ranged Weapons
1. Shotgun
- Name: Shotgun
- Damage: 10
- Range: 10
- Fire Rate: 5
- Ammo: 20
- Max Ammo: 20
- Reload Time: 3 seconds
- Icon Path:
images/Weapons/Centered/Shotgun.png
2. PlasmaBlaster
- Name: PlasmaBlaster
- Damage: 10
- Range: 10
- Fire Rate: 5
- Ammo: 20
- Max Ammo: 20
- Reload Time: 3 seconds
- Icon Path:
images/Weapons/Centered/PlasmaBlaster.png
3. SuperSoaker
- Name: SuperSoaker
- Damage: 10
- Range: 10
- Fire Rate: 5
- Ammo: 20
- Max Ammo: 20
- Reload Time: 3 seconds
- Icon Path:
images/Weapons/Centered/SuperSoaker.png
4. FnScar
- Name: FnScar
- Damage: 10
- Range: 10
- Fire Rate: 5
- Ammo: 20
- Max Ammo: 20
- Reload Time: 3 seconds
- Icon Path:
images/Weapons/Centered/FnScar.png
Melee Weapons
1. Knife
- Name: Knife
- Damage: 30
- Range: 4
- Fire Rate: 0 (instant use)
- Icon Path:
images/Weapons/Centered/Knife.png
2. Axe
- Name: Axe
- Damage: 50
- Range: 10
- Fire Rate: 1 (slow swing)
- Icon Path:
images/Weapons/Centered/Axe.png
Weapon Data Structure
Each weapon is represented by the WeaponData
class, which contains the following attributes:
- name: The name of the weapon.
- damage: The amount of damage the weapon deals.
- range: The range at which the weapon can be effective.
- fireRate: The speed at which the weapon can be fired (or used, for melee weapons).
- ammo: The amount of ammunition the weapon holds (for ranged weapons).
- maxAmmo: The maximum amount of ammunition the weapon can hold (for ranged weapons).
- reloadTime: The time it takes to reload the weapon (for ranged weapons).
- iconPath: The path to the image icon representing the weapon.
Usage
To fetch the data for a specific weapon, the getWeaponData()
method can be used by passing the weapon's specification (name) as an argument. For example:
WeaponData shotgun = WeaponConfig.getWeaponData("shotgun");
This will return the weapon data for the "shotgun" and allow you to access its properties such as damage, range, fire rate, etc.
Conclusion
This documentation outlines the different weapon types available in the game, detailing their attributes and providing a clear structure for accessing weapon data. The WeaponConfig class centralizes all the configuration, making it easy to manage and expand the weapon arsenal in the game.