What's an adventure game without swinging swords and twinkling treasure? Rubbish, that's what!

Posted by joshyaxley on Jul 3rd, 2015

When I first started working on this game, I planned on it being a jumping / puzzle challenge, as opposed to a combat challenge, but I quickly realised that I would much rather play a game where you get to slay foes and such, rather than just jumping merrily from cloud to cloud. With that realisation, I started working on making the Player able to attack.

The method of attacking is very important. Can the Player shoot arrows to vanquish foes at a distance? Or must they enter close-quarters combat and slice them to death with their sword? Can they attack in the air? Can they use magical spells to hit several enemies at once? Do damaged enemies get knocked away from the Player? All these, and more, are important when deciding upon the combat system of your game.







For me, I knew that I wanted the controls and mechanics of Faerie to be simple, and then to bring in the difficulty of the game via the level and enemy design. Thus, I settled for a simple sword, with a knockback effect to help prevent the Player from being overwhelmed.







So how did I implement this? Every step of the game, the Player checks to see if the attack control has been pressed, if it has, and the Player isn't currently recovering (read: reloading) from the last attack, he can attack again. When he attacks, he sets a recovery timer, so that he cannot repeatedly attack.

When the Player attacks, he creates an Attack_Box object in front of him, and tells it to destroy itself a certain amount of time later (which is less time than the recovery timer, so that the Player cannot be continually attacking).

This Attack_Box represents the sword, and in my game it is simply a large square that will damage anything that touches it. Every step of theg game, this object ensures that it is in front of the Player (i.e. where the sword is swinging).







As you can see, the hitbox is actually bigger than the sweep of the sword. This is so that Players do not have to be 100% accurate when attacking, and was a change made based on testing, when sometimes it would feel like you *should* have hit something but you didn't.

Another option for the hitbox would be to have it change its shape as the sword swings, so that it is always exactly where the sword is.

Now that I could attack, I needed something *to* attack! When I was developing this, I actually started by making enemies, but, if I had thought things through, I would have started with "Breakables". Breakables are (as you could guess), things that you can break. These range from pots and vases, to chests and cages.







In a lot of games, I feel that they go overboard on breakables by putting way too many in the levels. Some people might like it, but personally I don't enjoy feeling like I have to break every single pot just because one of them might have some gold in. The first breakable that I decided on for Faerie was a simple chest that would contain some treasure.

The inclusion of treasure itself was quite a hard choice. I'm always wary, when adding in new mechanics, that I'm not making the game unnecessarily complicated. However, I wanted some form of player progression, and I had decided that this would come in the form of collecting treasure, and spending it in some way that improved the player's character.

So that I could easily add in other types of breakables in the future, I started by making a Breakable Parent object (of which future breakables would be children of, and inherit all of the parent's properties).

The object was simple. It had health, if it got hit (i.e. if it collided with the sword Attack Box), it would lose health. If it lost all of its health, it would be destroyed and would reveal whatever was inside of it. In the Chest's case, this was Treasure.

I wanted my treasure to be colourful, so I made several different types (gold, sapphires, emeralds, and rubies) and gave them all a different value. Whenever the Player collides with some treasure, their total treasure is increased by the value of the treasure that they collided with.







I also added in sound and particle effects, but I'll be talking about those in another blog!



That was quite a short post for me! Next time, I'll be talking about the enemies that I included, so watch this space for that!

Still working on the demo, I hope to have it ready soon-ish! In the meantime, enjoy the video that I made previewing one of the levels:



Feel free to follow me on your favourite social media!



Josh