Level Building and Attacks


I would have argued level building was not really important for a game like this but there were a couple of game features that sort of complement level building.  I admit, the background and floor needs a bit of work done but that is being left until polish.

Firstly,  I needed the sprites for the characters overlap on the correct layer.  To do this came up with a mathematical method sort the characters into different sorting layers based on the bottom of their sprite.  This script would be applied to each character in the game and refresh every frame.

base pos: transform Y - (scale Y / 2)

bottom of screen = -5

amount of sorting layers =  100 = (1 / 100)

layer to sort to = base pos * (amount of sorting layers + bottom of Screen + sort of background)


After I added it I would have this problem with characters being sorted based on their pivot or center point.  The little kaiju was added to test this because it is intended to have the same height of the enemy characters, being half the size of the bigger kaiju.

To alter change this I made a change to how base position was calculated.  Instead of dividing by 2 I instead multiplied the scale value by a "buffer" that can be changed in the editor.  In retrospect, this may only work for in the case of the Kaiju because the other characters cannot move to overlap each other.  The scale value should also be replaced with 1.

Figure 2.

Figure 2. Overlap Working

Next to complete level building wanted to add a stomp feature that would add to the effect of an attack.  Before I did this I had to get the animations for stomping complete.  Hopefully it saved time later in development because it took a bit of time to do it.

Figure 3.

Figure 3. Kaiju Animator View

This may be a bit over complicated and could be simplified using blend trees but it works like this:

  • Each stomp animation has 3 states: Startup, Active and Cooldown.
  • Each stomp state has a "Stomp" tag which is used by the movement script to convert the velocity to 0.
  • The left and right attacks use a variable called "FacingRight" which are used to make the kaiju to stomp in either direction even when still.
  • The Cooldowns are used by the stomp script to make the screen shake using an if statement.
  • The Active states are GOING to be used to activate the collision boxes on either side of the kaiju to indicate that an attack has been made.  When the kaiju stomps, their feet cover the boxes.

Feet

Figure 4. Kaiju Attack Boxes

  • The different states have different frame lengths.  Startup = 4, Active = 2 and Cooldown = 3.

This system is an attempt to replicate the attack animations in fighting games.  Strong attacks are slower but do more damage and have longer range while light attacks do a small amount of damage but will beat a heavy or make it easier to punish.  Each frame is one-tenth of a second currently so the whole animation is 0.9 seconds long which is a very slow attack perceived in a fighting game.  At the moment I would say that the startup being slower than the cooldown doesn't seem right, you almost have to wait for it to finish so you can keep moving again.

Back to the screen shake feature, I'm not completely happy with it.  I would prefer that the amplification would exponentially decrease after moment that the cooldown state was entered but at the moment I have not found a way to access the amplification and can only enable and disable the cinemahcine camera which can leave the camera in a random position after the brain is disabled.

Figure 5.

Figure 5. Screen Shake

Next I will make the enemies, give them similar attacks and make the attacks do damage.  The kaiju will probably need a third (technically its the third because I flip the sprites) to show that he has been hit with an attack.

Files

Super Stompy Build 2.zip 7 MB
May 07, 2021

Get Super Stompy Kaiju Revenge

Leave a comment

Log in with itch.io to leave a comment.