The Design and Code of Aetherial’s Harpoon

As I have mentioned in my previous blog post, we wanted the Harpoon to be more versatile than it was supposed to be in the original concept document. Instead of being the weapon of choice for the player we decided to make it slow firing, but deal a lot of damage. This way the player still wanted to use it in certain situations, but since the harpoon also couldn’t be aimed he would have to use the beam attack to deal with the more nimble enemies. One of our goals was to make the harpoon play a critical role in taking down the boss, mostly because we felt that it would fit the aesthetic goal and also to be a bit closer to the original concept of the game. As a solution we decided to make the harpoon be the only choice for the player when he wants to destroy aether crystals, which are introduced early on in the game as a way for the player to regenerate aether (his resource for firing his beam). This way we manage to prepare the player for the boss fight in which he will have to fire at weak points in the leviathans armour using the harpoon. Which will then enable the player to rip off the armour plate and expose the leviathans vulnerable skin. To indicate we will use the same crystal sprite we used for the aether crystals, so the player already knows he can only destroy these with the harpoon.

The code for the harpoon is basically a simple state machine, which switches between the states “Reloaded”, “Fired” and “Stuck”. In the “Reloaded” state the harpoon has it’s position fixed to the player objects position and can be fired straight ahead by pressing the space bar or down at a 45° angle by pressing the F key (These controls are very much work in progress). When either one of these keys is pressed the harpoon will transition to the “Fired” state and just move forward at a certain speed, either until the reload time is reached in which case it is returned to the “Reloaded” state or until an object with the tag “BossCrystal” is hit. In that last case the harpoon will enter the “Stuck” state and have it’s position be set near the crystals position. At this point another script takes over to manage the players ability to remove the boss’ armour plate. Once the armour plate is destroyed the harpoon returns to the “Reloaded” state and it’s original position.

Besides the state machine the harpoon also collides and destroys objects tagged as “Crystal” and deals a high amount of damage to objects tagged as “Enemy”.

Harpoon

About Matthias Jannidis

2017 Programming