How to make a slasher game

Note: this tutorial is out of date. You can use the concepts from this tutorial combined with the up-to-date tutorials listed below:

 

Today I will demonstrate how we can quickly make a sword-fighting game by taking advantage of a couple of new features in Gamefroot. Pretty much every Gamefroot game so far is based on shooting people, so lets add some variation into the mix! Here is an example of the kind of game we want to make:

Skeleton Slicer!

 

There are two parts to this; one is creating the animated swinging sword, and the other is creating the damage zone. We will be creating two scripts – one for each feature.

By cycling through different custom weapons that hold a sword in different positions, we can create an animated sword swinging effect.

Let’s get started by making a new platform level in the Level Editor. We will need a character that doesn’t have arms so that we can animate them independently. We can create one using this character spritesheet here:

Right-click the image and choose “Save image as” to save it to your computer. Then create a new character in your level using the spritesheet. Click here to learn more about creating custom characters.

Place your character somewhere in your level. I’ve drawn a tunnel of stone tiles, and my character is going to start at the left and fight his way to the right. Also place down a bunch of enemies for your character to fight – I changed my skeletons’ enemy properties so that they cannot shoot, and deal damage when the player collides with them.

Then create the custom weapons that will make up the sword slash animation. Here are the sword images I used:

  

Upload these 3 images as custom weapons to an asset pack. Click here to learn more about using Asset Packs.

Each custom weapon should have it’s weapon mount points set at 0,0 and bullet spawn points at 0,0. Also, the bullet settings should be set to one bullet every 99999 ms, with bullet speed 99999 and bullet damage 0. This will effectively disable bullets for the weapon (we don’t want swords that shoot bullets!).

 

(Make sure that the asset pack your character and weapons are in has been added to the palette, or you won’t be able to use them.)

 

 

 

Now let’s create the behavior that will give our player a sword. Open the Behaviors tab, and click Create…

Then create a script that looks just like this:

If you are unfamiliar with advanced behavior scripting, click here to learn more. This script will first make the item go invisible and give the player a sword. Then whenever the player presses space, the weapon changes to the sword that is held high, and then changes to the sword swung down. This script also sends the message “kill” to the next script we will make which will damage any enemies being chopped up.

Save the script, and then place an item somewhere on the stage. Paint the behavior onto the item by selecting the script from the behaviors tab, and clicking on the item on the stage. This will add the script into your game.

Great! Now save and preview your game to test out the sword. It will not deal any damage yet, so let’s work on a script for just that.

Create another script, and make it look just like this:

Save it and paint it onto another item in your level. This script will cause the item to go invisible and float around in front of the player wherever the sword is, and when the sword swings down this item will damage any enemies that are touching it.

You should now have two items on the stage with these scripts applied, a character with no arms, and a bunch of enemies to slice up.

Save your game, and your done – at least with the tricky parts. Now all you have to do is add more terrain and enemies.

Your game should play exactly like Skeleton Slicer. Have fun chopping skeletons!

Skeleton Slicer!

6 Replies to “How to make a slasher game”

Leave a Reply