Week 5: Development Journal


This week continued on with the focus on the development of the game.

This shows what the game/ gameplay looks like at the end of the week which includes spawning multiple enemies over the just one before, animations to movement and combat including killing of enemies and player health/ dying. This is shows that I had enabled the debug from this point on (the boxes around the player and enemies).
This is the changes done to the create and update function within the HTML file of the game the wasn’t any changes to the preload so I didn’t include it here. Changes include the player create function of the player JS file is now equal to player which is then passed on to the enemy create function in the enemy JS file. The changes to the update function is more of just passing the game instance to the different functions of both the player and enemy JS.
The player preload and create functions had a few changes to them which for preload was just preloading more of the player specific assets. For the player create it was adding the keyboard input of space for attacking, the player down animation and returning the player.
The code for all the directional movement animations.
The code for all the attack animations for each direction.
These are the more minor changes to the player update function including the detecting if the game is over, the player health UI in the update function for updating any changes to player health throughout the game and the player invulnerability.
These are the rest of the changes to the player update function which is mostly the addition of calling attack animations through the space key being pressed. Also the check if the player health is 0 or less for setting game over true for the check previously. Finally the function for resetting the current animation so it doesn’t get stuck in an animation for example getting stuck in an attack animation.
For enemy JS there were no changes to the preload function but was for the create and also the addition of the enemies variable which was used for handling the enemies group. The enemy create function has been completely reworked to use the enemies group to allow spawning of multiple enemies and using that for spawning 3 enemies. Also passing each enemy in the enemies array health based on the enemy health variable from before and an invulnerability timer. Also adding overlap to the player and enemies.
This is the function called when the player and enemy overlap first we have the checking if the player is attacking the enemy through checking if the player animation includes the word “Attack” which if it does and the enemy being attacks invulnerability equals 0 then the enemy takes damage and gain invulnerability. If the player isn’t attacking then it is checking if the player is invulnerable if they’re not then the player takes damage and gains invulnerability. Finally for the purposes of testing while developing logging the player and enemy health any time they overlap.
The code for all the enemy directional movement animations.
There have been some changes to the update function where it iterates everything for all the enemies where it sets enemy to = child of enemies so most the logic can stay the same for movement over how it was before and taking away enemy invulnerability if the enemy has any.
The Trello board at the end of the week.