Update: Quick Update

Just a quick update.

I am continuing work on the level creation and have fixed some bugs.

The AI is now more advanced. They are able to detect when the player is nearby and which direction they are coming from.

The camera is now more centered. This change was made, because when going left, you couldn’t see much ahead of you.

A HI-SCORE has been added and a win screen has been added.

My next goal is to finish the first level completely and to add in a game over screen. If I am able to finish this before the end of next week, then I will also be adding in tweaks, like scenery and graphical changes.

Update: Game Update V1.7.0

References to blog posts used:

Update: Locked Doors, Keys and minor improvements

Update: Flute Mechanic Enemies Fixed and Changed

Update: Level 1 Completion so far

 

V1.7.0:

  • New NPC added
  • Flute mechanic changed and now working
  • Locked and Unlocked doors added
  • Keys to unlock doors added
  • Lives added
  • Ladders added
  • Texture added to wall rat can run through
  • Story added
  • Cut-scenes added
  • Room fade added
  • New sound effects added
  • 1 room modified
  • 2 rooms added
  • UI changes
  • Bug fixes

This update did take a while to come out, but I am happy with the amount included in this update.

Update: Flute Mechanic Enemies Fixed and Changed

I have finally done it! I have fixed the enemies code, which detect the flute being played near them. It took much longer than expected. This was due to the program engine GMS2 bugging out when I tried to add in a puzzle feature and a reset to failed inputs. In short the code was correct and ordered correctly, but it still didn’t work, unless I used a text box pop-up.

I have no idea what the issue was. I  searched through all my code and tried countless fixes, but nothing worked, so I changed my design on how it should work.

The way I wanted it to work was to have a unique input for all guards and as soon as one input was incorrect, it would reset on that frame. Unfortunately this didn’t work, so I made it use a timer instead, which will resets the inputs after the timer hits 0.

Well enough of the explanation to why I changed the design and on to how I made it:

flute_guardId

On the begin step on the Player, I added in detector, which will detect what guard is close by. Once detected it will send off the results to the guard object. The reason I didn’t check for the results in the guard was because, I would only be able to check if the object is nearby and not, which instance of that object is nearby.

Continuing on I wrote the code for the input check:

flute_input_check

I got the number_pressed value from the player, after the flute animation plays the specific animation according to thee key pressed.

Once the key input is pressed it checks down the list, looking for the current sound it is on. Afterwards it compares the number_pressed value to the Sound_(1, 2 or 3) value and if they match it will play a sound and move on to the next input check. If all sound inputs are correct, it will make the guard fall asleep for 5.6s.

When the guard is asleep, they are safe to walk passed. The player is told in three ways that the enemy is asleep. The first is a snoring sound will play, which I got from here:  https://freesound.org/people/monkslut/sounds/35208/. The second indication is Z above the enemies head:

guard_sleeping

The third way is by removing a timer, which I added it.

To add in the timer I first had to set it up, so I wrote this:

guard_flute_timer_reset

This sets up a timer for the guard and for the player. Once the timer hits 0, it will reset the inputs. Just with this I can reintroduce the same patterns, but reduce the timer, which will create another challenge with no new code needed.

To set up the visuals, I coded this in the player:

flute_timer_setup

The code above sets up a timer to be drawn and then restricts access for the code to continue activating again, unless requested again.

timer_draw_code

The above code was used to create the cool-down timer visual. It uses an alarm, which triggers 100 times maximum before  it is destroyed. Each time it triggers, it reduces the cooldownPercentage value by 0.02. This is so it will end up at -1, which means the start and the end point will have 0 pixels in between, meaning it won’t create anything.

When the cooldownPercentage value reaches -1 or below or the guard fall asleep, then the instance will detroy, meaning no more timer. Here is the timer in action:
timer_counting_down

I am extremely happy that this is finished and is better than anticipated IMO.

I am working on finishing off the first set of rooms and then I will update this blog post and soon afterwards I will create and release the game update V1.7.0 blog post.

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.