Week 2 - Player Abilities


This week's focus in on finishing player abilities. The reason I have not moved onto world and level design is because the world revolves around the combat mechanics of this game, so I want to finish up the combat mechanics so that the world is easy to traverse.

I decided that instead of creating multiple elemental classes, I combined them together and created a class that is a "master of all elements". I also had plans to create a special ability that would change depending on the last used ability, but due to the complexity and unforeseen problems with the normal abilities, I instead made the special ability something cool to differentiate itself and "ninjafy" the game a little bit. Each ability as well I made them cool in their own outright; some may be more flashier than others.


Water/Ice

The first ability I made was the ice spear (see Fig.1). It's a giant spear made of ice that is summoned above the player that when held, will rotate towards the mouse's position. When released, it continuously travel in the given direction, piercing through enemies and only coming to a stop when it collides with the terrain (see Fig.2 for a demonstration).

Fig.1 - Ice Spear Sprite

Fig.2 - Ice Spear throw, piercing enemy dummies

It was fairly easy to make and the most straightforward, hence why I started on it first. I did run into a few problems though, most notably running into script problems where I was trying to instantiate the spear and change its properties (such as its rotation) while not causing duplicate sprites to be instantiated (see Fig.3). The fix I came up with was to simply only instantiate the ice spear from the player and let the spear itself do all the code running it needed.

Fig.3 - Instantiating too many ice spears

Fire

The next ability I moved onto was the fireball. I created a fire sprite that would play while charging (see Fig.4). The mechanic of the fireball is "charging". There are 3 levels: The first level is a simply projectile that travels slowly on a horizontal direction and is destroyed upon collision (see Fig.5). The second level creates a faster fireball that explodes upon impact (see Fig.6). Then the final third level is a "kamehameha" that creates a laser that melts all enemies in its range (see Fig.7).

Fig.4 - Fireball animation


Fig.5 - Level 1 Fireball



Fig.6 - Level 2 Fireball



Fig.7 - Level 3 Fireball (x2 speed because video is too long) (Text is not part of the game)

Despite the different animations required and different levels required, none of them were particular hard to make, especially after I knew what I was doing after creating the ice spear. I did have trouble creating the laser initially but it was just a matter of trying to position each sprite correctly as I was creating the laser with an sudo-infinite (child) instantiation loop. The hardest part was keeping the fireball with player while the player still retained velocity. Unlike the ice spear where I liked the idea of being able to cast the ice spear in its position but still retain player velocity in situations such as in the air, I wanted the fireball while it was charging to maintain position with the player. And for some reason, the fireball was following the player's direction after launch, which should not happen. Fig.8 demonstrates what I did not want happening.

Fig.8 - Fireball not working as intended (x2 speed)

Lightning

I then moved on to the next ability - the lightning bash, an ability that was inspired by Ori's bash mechanic. This one was a pain to develop as it required finding an enemy at the mouse's position, then on click, destroying the enemy and transporting the player to that position before launching them off in a specific direction. I probably overcomplicated the ability, but I wanted it to be a near identical recreation to Ori's bash.

To start simple, I was able to make the player be transported to the mouse's position. I then added sprites to create a lightning chain effect. This proved extremely difficult as I was only getting sprites created the positive axes and my sprites did not rotate correctly (see Fig.9).

Fig.9 - Initial testing of bash mechanic without targeting enemies

I eventually got the sprites to work as intended and was to quickly figure out how to target the enemy with the help of raycasting. I even added some UI effects to help signal to the player which enemy they were going to bash to as shown in Fig.10.

Fig.10 - Bash mechanic able to target enemies

However, I needed the enemies to be destroyed on command. Destroying the enemies was not a problem. What was a problem was what happened after an enemy was destroyed. Fig.11 shows how once an enemy was defeated, the bash could not retarget a new enemy. There were some conditions that allowed them to retarget such as enemies being displaced, but I did not want the unreliability of it as enemy programs in the future could be temporarily stationary for a long period of time. I eventually got it fixed as shown in Fig.12. A quick minor bug which I fixed as soon as discovered was that I could bash through walls (Fig.13).

Fig.11 - Bash not able to retarget unless enemy was moving


Fig.12 - Bash working as intended

Fig.13 - Bashing through a wall

One thing my bash did not have which Ori's bash did was the ability to freeze time temporarily and allow Ori to "bounce" off its target. This was relatively complicated as I needed a arrow to display where the player would "bounce" off of and rotate around the enemy.  Fig.13 has an arrow that did not display correctly. I also couldn't didn't want to freeze time entirely, so I just set the time scale to be a really small number temporarily.

As I began testing, I was struggling to figure out why all of a sudden the bash stopped working. I later found out that the cooldown for the bash, which I had implemented just before I begun adding the "bounce" effect, was being called too early and preventing any more functions from running.

Eventually all was fixed and the result is a fun movement ability as shown in Fig.14.

Fig.14 - Bash in its final state


And finally, the special ability (current working name is Shadow Slash) was the easiest to make. It's just an ability that charges over time and when unleashed, will play an animation and destroy all enemies on screen as shown by Fig.15.

Fig.15 - Shadow Slash ability in function

As a bonus, I found a new player I liked and changed it to Fig.16. I found it to be a better fit of the mix between Wizard and Ninjas.

Fig.16 - New player sprite

Peer Review

Unfortunately due to the scale of this weeks tasks and many problems encountered, I did collect any peer reviews. Reviews will be collected next week (week 3).

Next Week (Week 3)

Due to the extensiveness of this weeks tasks, I did not have time to create proper enemies. Nor have I properly finished my abilities (such as stealth) as they require interaction with the enemies. My plan for Week 3 is to create a simple introductory stage and a combat stage for infinite fighting. After that, I will then continue making the enemies.

Leave a comment

Log in with itch.io to leave a comment.