-
-
Notifications
You must be signed in to change notification settings - Fork 118
Custom Weapons Walkthrough
This page will walk through the process of creating a custom weapon.
Let's start with a blank campaign. This one is very basic and will simply let us try the weapon out. There are a few scattered map objects that we can blow up.
The campaign itself will be a folder, inside there are these three files:
Custom weapons start with guns, defined in a guns.json
file. Go ahead and add this, with the following contents:
{
"Version": 1,
"Guns": [
{
"Name": "My Gun",
"Bullet": "my_bullet"
}
]
}
And create a bullets.json
file too, with the following contents:
{
"Version": 1,
"Bullets": [
{
"Name": "my_bullet"
}
]
}
You can see what's going on here: the gun we've made will shoot the bullet we've made, by referring to it by the same name. The bullet name doesn't show up anywhere else so it doesn't really matter what we name it, as long as it's unique.
If you open the campaign up in the editor, you should see that this gun already shows up in the "Available weapons" section:
At this point we can actually load this campaign up in game, and try out our new weapon...
... and it does nothing except make a lot of noise. We need to fill out those gun and bullet attributes now.
There's a big list of gun and bullet attributes here. No matter what weapon you make however, you'll probably want to change these:
For the guns (guns.json
):
- Cost: how much score each shot costs
- Lock: how much time between shots, in terms of game ticks. This controls rate of fire.
- Sound: the sound that this gun makes. Different guns should make different sounds!
For the bullets (bullets.json
):
- Pic: probably the most important, what the bullet will look like. There's actually several different types of structures you can use here, from basic images to animations. The most common types would be "Normal" and "Directional".
- Speed
- Range: how much time, in terms of game ticks, this bullet stays alive for.
- Power: a.k.a. damage