Update: Running Jump Added

Hero_Run_jump_V3

The running jump is  finally finished. The new animation is 9 frames long.

To get this animation to work the way I wanted it to, I had to rewrite the whole run animation. This just meant I needed to to separate the normal run and the running jump animation apart and give them a state role.

With all the normal new code completed, I started on the running jump animation. To start this off, I added in the create code:

run_animation_create_code

In the screenshot above, I only used the speedUpAnimation boolean variable. The other new variable I added in, just in-case I want to slow things down, but only want the event to trigger once or a limited amount of time.

Going on from this, I rewrote the run code:

running_to_runningJump_code

This is where I altered the run animation to be separated from the running jump animation and gave it a name. I also made it so the animation_action will go back to the default when it is not being used, aka player stops running.

With the new run code I checked to see if the player was pressing the jump button:

jump_code_V3

I altered the jump code from before, so the program can distinguish the difference between if the player is standing still or moving left or right.

Going on from this I applied the running animation:
Running_jump_speed_up

The code will allow make the player run extra fast for up to a second. The reason I added in a delay was because, the player could abuse the extra speed, so the running mechanic is no longer useful.

The reason I added in the extra speed, was because I didn’t want to restrict the player too much and I wanted the run to feel more realistic.

Next I needed to launch the player into the air:

running_jump_to_jumping

The code above resets  the speedUpAnimation variable and puts it into the same rising/falling loop as the standing jump animation.

This is what the running jump looks like in-game:

running_jump_in_game

 

 

Bugs and glitches:

I did encounter a bunch of problems when coding this function. The first one was if you let go of the move button after you pressed the jump button it will bug out the character and start playing the idle animation when moving again. Here was the fix:
force_movement_running

The code above will make the player move in the direction they’re facing. It does restrict the player a bit and may make them think the game is lagging, but I currently can’t think of a better solution, except maybe make a jump for every single run frame, but that would be very inefficient and cause lag and issues.

The next problem I had was the animation playing when the movement keys were hit at the exact same time. Here’s the solution:
fix_animation_playing_bug This doesn’t fix thee issue entirely, but it reduces the encounter rate to almost 0% and reduces the severity of the bug if it does occur. If it triggers now, it will just make the player stand still for 1 extra frame or stop the player until prompted to move. You would have better chance winning the lottery than encountering the bug, so I think I’ve fixed it as much as possible.

The next bug I encountered was the player getting stuck in the wall when using the running jump animation, this is the fix I made:

stop_player_from_runningJump

Slow_down_player_X_speed

The above code stops the player from activating the running jump animation when they are next to a wall and pushes them back a bit, because the player will get stuck if they aren’t pushed back.

The other code above will slow down the player’s x movement speed when they get close to a wall, so they won’t stop inside the wall.

With this done I encountered one more glitch, which was the player being able to double jump if they held down the jump key, after the running jump animation started.

To fix this issue I added in a new variable called, isRunning, which I used to be able to tell the player is running before they jump into the air. Once in the air, if the value is true, it restricts access to using the standing jump. Once the standing jump is used it is locked, but because it hasn’t been used, it is unlocked and I needed a way to lock it.

Once the player hits the ground, the isRunning is set back to false. I may change the name of the variable in the future, but I haven’t decided what to just yet.

One thought on “Update: Running Jump Added

Leave a comment