Adding New Weapons

In order to add a new Weapon, you will need:

  • Custom Sprites or Weapon models for 2.5D games if desired.

  • Custom VFX if desired.

  • Custom SFX if desired.

Note that you can use the assets provided by Platformer Engine if you want!

Procedure

First, we must create a new Weapon_SO. You can store them anywhere, but it´s good practice to keep them all in the same folder.

You can create a unique Weapon_SO for each weapon by right-clicking in your Project folder, going to Create → COWSINS → New Weapon.

Now, you can modify all the parameters as you need to create your desired Weapon! If you need further explanation on what each parameter does, please refer to Weapon_SO.

After this, make sure to fill up the next items:

Once we have the Weapon_SO created, we need a Weapon Prefab. We will search the GenericWeapon which is located under the following path ( Cowsins > Prefabs > Weapons )

We want to duplicate this object ( Ctrl+D ) and give it a name, then open it.

Inside it, change the sprite as that will serve as the visuals for your weapon when unholstered.

Then, navigate to WeaponIdentification and assign the Weapon_SO we just created.

Next, create a new empty object as a child of the imported model/sprite and call it MuzzlePoint. Note that you can create as many muzzlepoints as you want, so you can make two handed weapons etc. You want to locate the muzzle point at the tip of the barrel, as it´s the origin of shots.

Once you are ready, assign this weapon object to the Weapon_SO we created previously.

Just like this, our Weapon is ready. If you want to add Animations to the Weapon, refer to the next section Adding Animations

You can assign your weapon on the Initials weapons array in the WeaponController ( located on the Player) to automatically receive it on your inventory when the game starts.

or you can drag and drop a generic weapon pickeable from Cowsins/Prefabs/DragAndDropExtras and assign the desired weapon_So. Like this, you will be able to interact with the pickeable and unholster the weapon.

Adding Animations

You can duplicate the Generic Weapon animator controller from Cowsins / Animations / Weapons, rename it and assign it to the Weapon Object Animator. There, you can assign your animations inside the corresponding animation states.

Now, everything is fully set up, and you are ready to have fun with your new weapon in Platformer Engine!

Best Practices

It is highly recommended to use the provided template for creating weapons. Following the same structure as the example weapons included with the asset is advisable as well.

Last updated