Update: Locked Doors, Keys and minor improvements

Assets used:

https://freesound.org/people/kausha/sounds/475839/

https://freesound.org/people/InspectorJ/sounds/431117/

https://freesound.org/people/Disagree/sounds/433725/

Key graphics

The above image is the key graphic for the game. It can be picked up by the player or the rat. Once picked up it will make a ding sound affect. It looks like this in game:

Key item

To get the function working I needed to give the key an array of reference variables. I set this up in the key create menu and called it keySelection[]. This might sound like it works, but for some reason it won’t let me use the variable when called where I wanted to use it. The fix to this is to give every single object using it a replica variable, which stores the value and uses it in their own code and not an out source.

Once the replica variables were made I added in the pick up key function:

Player_key_pickupRat_key_pickup

For the player I could adjust the things straight away, but for the rat I need to past over the variables, which is done through this:
Rat_key_passOver

To explain the new variables shown above. The doorNum[] is an array of reference variables and the doorKeys[] is an array of booleans and the doorNum[] and doorKeys[] index will have to be able to be checked, otherwise an error will occur or nothing will happen.

Anyway continuing on from the previous code, I setup the code in the press E action, for the door function if the key has been picked up:
Door_GoTo The code above is first checking through every door in the level to check if the player is colliding with it. If the player is colliding it checks if the key has picked up and if it has it will create a new variable called xy, grabbing a reference GoToDoor value, which contains an integer number, which is then used to save the new X and Y spawn points. The integer is used as an index number in the array doorNumb[], so it can find the right door.

Once the door is found it will teleport the player to the new location after checking it is in front of the door. If this is done both together, it will teleport the player and then checks if the new door is unlocked and if it is, it will teleport the player back and that’s why the code is like that.

The door now looks like this:

You may have noticed the E above the head. That’s part of the minor improvements I was on about.

The E button uses the same object as the text box, but it uses a boolean to separate the two, but before I could separate them I need the code for the create menu:
E button create variables

The code above is used for opacity, the button and whether the player is colliding with any interactables.

e_button_interacting

Once done I setup the button to be shown:

Interact button

The code above is setting up a fade in and fade out. Afterwards I setup the code, which will draw the button:

E_button_draw_code

The extra draw_line_width is to add a border. I wrote similar code for the dialogue box, so now they look like this:
Dialogue_box_prompt_text

I also altered the menu slightly, so it looks better:
Incredible Notes Menu V2

Update: Game Update V1.6.0

Blog posts referenced:

Update: Guard Idle Animation

Update: Standing Jump

Update: Menu Added

Update: Running Jump Added

 

V1.6.0:

  • New guard idle animation
  • Landing from jump animation
  • Running jump animation
  • Standing jump animation
  • Falling and rising animation
  • Menu added
  • Option menu added
  • Music added
  • some sound affects added
  • Various Bug fixes

 

This was the biggest update I’ve ever done so far, it took 2 weeks to make everything and I couldn’t be happier with the amount I have accomplished. My next big update goal will be to complete the first room of the game and to get the rat key gather and unlockable doors working.

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.

Update: Menu Added

Tutorial used:

https://www.youtube.com/watch?time_continue=14&v=BiiOiYXiSbI&feature=emb_logo

Assets used:

https://freesound.org/people/broumbroum/sounds/50557/

https://freesound.org/people/ShadyDave/sounds/326553/

 

Incredible Notes Menu

After following the  tutorial above, I came up with this. It is quite simplistic, but it works well for what I needed.

Following on from the tutorial I added in music made by ShadyDave from Free Sounds. I then added in a second menu section, which can be accessed through options:

Options_menu Currently there is only two options; Music and Back. I plan on adding a third option, which will be called, “Controls”.

The current option Music will turn on or off the music. Basically it’s a switch. To create this I needed to add in some extra code in the create action:

Menu_create_code

The four new things added were:

  • Music that will loop continuously, unless commanded not to
  • A way to turn off and on the music
  • A way to tell, which menu has been selected
  • A string that changes the menu title name

Once done I added in the new code in the enter pressed action:
menu_enter_commands

In the code above, the menu selected will be decided depending on what the menu_selected value is. Once selected it will look at the current menu_index, which is shown in game by a red colour. It will then run the output of the case selected.

The reason I am changing the buttons variable is because, it says how many buttons should be on screen and what buttons can be selected.

Menu_title_code

If you want to add in title text, then you will need to something like the screenshot above. You will have to set the color of the title before it is written, because for some reason when the very last menu option is selected the title will turn red, unless you set the color to the default color before writing it on screen.

Update: Standing Jump

Hero_stand_into_jumpV3

The above animation has been used for 3 sets of animation, going into a jump from standing position, jumping and landing. It took about a whole day to complete, because I wanted it to look smooth.

To first setup the animation, I needed to create some new variables in the create action:
Jump_animation_create_code

Once I created the code, I altered the jump code, so it requires the into jump animation to finish, until the player jumps into the air:
jump_code_V2

Afterwards I wrote the animation code, which tells the program when to push the character upwards and when to change the animation to the rising/falling animation:
setup_jump_animation

Once this code is finished, the program then should check through this code to see if the requirements have been met:

Falling_and_rising_animation_code

The above code is changing the animation_action variable, because it will need to be used when hitting the ground.

Now that the jump code has been finished, this is what I have:

With all the jumping done, I added this code in to setup the landing code:

standJumpLand_to_Landed_code

All this is doing is changing the animation_action variable. This is so the program can tell the animation is now playing and not just waiting.

From this point I added in the animation code:

Landing_animation_code

This code will reverse the animation speed to -2 (I know it says 0.2, that’s because I forgot to change it when taking this screenshot). Once the animation has reached a certain point, it will bring the animation_action back to default, which means it can be used again. Here is the landing animation screenshot:
Landing_animation

The animation is now complete, sort of. The animation is complete, but with it complete there were quite a few bugs, glitches and errors, which I needed to fix. I didn’t take screenshots of the code fixes, because I thought it wouldn’t be that necessary.

Some examples of issues I encountered were:

  • Spelling error – I misspelled a value, so it wasn’t doing what I wanted it to do.
  • Animation playing when a movement key is pressed – The issue was a weird one, the problem of the animation playing, was because of the run function I had. With it unlocked it played animation when the movement key was held down, but only at a certain point.

 

Update: Update V1.6.0 Completion date

The update V1.6.0 will be coming around Thursday 7th May. This is because, I have big plans for the next update, so it will take longer than normal.

The next update will improve the feeling of jumping and will include about 5 new animations. Yes you heard that right, 5 new animations. Most of the animations aren’t necessary for mechanics, but they improve how the game will feel.

Update: Guard Idle Animation

GuardStomp_V2

Above is the new idle animation, called the ground stomp. I put in a little extra work with this animation, I added in particle affects to make the animation feel more intense and I made the weapon add shading to the player.

To make the creation of this animation easier, I separated the arm from the body, which initially was attached to. I then put the spear on a different layer, which was in between the body and the arm.

By separating the body parts it made shading much easier and I had to worry less about colliding parts. From realizing this, I am considering separating the body parts on the other animations if I use them again.

Anyway continuing on from the animation, I started to implement it into the game. To do this I first added in the code in the create action:
Guard_idle_animation_setup

Once I have the create code, I wrote the code that would apply the animation and sound affects:

guard_idle_animation_code

I have only added sound affects on 1 other animation, which is the flute, but I thought that this animation really needed the sound affects. I might add it to more, but that would be part of the refining stage of development.

With all the code added in, the end result looks like this:
Guard_idle_animation_sceenshot

Update: Guard Spear Added

The above images is the guard without and with a spear. I added the spear, because a guard isn’t a guard without some type of weapon and I thought a spear would fit the best, plus I can add in a stomping weapon animation much easier.

The spear is not a typical spear design, I wanted it to look different from most spears, so I designed the look based off of fantasy games, old spears and the symbol of the badge shown on the guards hat.

This is what it looks like in-game:
Guard_Design_V4

I may alter the size of the spear if needed, but for now it is not needed.