-
Notifications
You must be signed in to change notification settings - Fork 3
Adding new weapons
This guide explains how to add a new weapon to the game. There are 4 basic steps
- Creating the weapon
- Creating the weapon item
- Adding the weapon item to the game
- Adding textures and sounds to the credits
The best way to create a new weapon is to inherit from res://Scenes/Weapons/Weapons/WeaponBasis.tscn
. This will give you a decent foundation. You need to add a texture as well and, depending on the required functionality, extend the script. Notice that you also have to provide a bullet scene. If none of the available bullets fits your gun, you have to create one yourself. This can be done by inheriting from res://Scenes/Weapons/Bullets/BulletBasis.tscn
.
To create an item for your weapon, inherit from res://Scenes/Items/Helper/ItemBasisWeapon.tscn
. Provide a texture for the sprite node and make sure, that the collision shape matches the item sprite.
To enable your weapon item to be spawned during gameplay, you have to add it to the spawner in the main game scene. Therefore, increase both, the Item array and the Likelihood array, by one in size. Add your weapon item and set the likelihood at the same index. These likelihoods are relative to each other, which means an item with a likelihood of 20 will be spawned twice as likely as one with 10.
You have to manually alter the Credits.txt file in the root folder to add new sprites and sounds. Find the appropriate space and use the syntax whatsound - Creator - Link - License
. If the license has not been added at the bottom of the file, do so.