Week 6 (14-20 Nov 2022)

This week I didn’t manage to get much coding done as I had been unwell for most of it, but I did manage to get the programming fundamental task done.

Phaser Classes

For our programming fundamental task we were assigned to look into five Phaser classes and see what uses they could have in 2D games. One of the classes I discuss is the phaser camera class which allows me create a camera which follows the player at a close range, preventing them from seeing to far into the distance.

Among other useful classes, I found the text class which would allow my to display text on the screen which I could use to help show when the player has won or lost the game.

New code

This week I didn’t write as much code as the one before it but there is still progress nonetheless. I created an enemy which follows the player at all times, this enemy will also remove health from the player when colliding but that will be implemented at a later point in the upcoming week.

Zombie sprite sheet
Loads the sprite sheet
Creates the walking animation
Spawns the enemy at a random place in the map with its animation on loop
Sets the enemy origin, resizes the enemy hitbox to be smaller, resizes the enemy to be bigger than the player and sets world collider boundaries
Makes the enemy face the player when moving towards them
Moves the enemy towards the player at a predetermined speed of 100

This code successfully created an enemy which move straight towards the player. Next I needed a camera which would follow the player.

Creates a camera objects and sets it to target the player

Goals for deadline week

Next week I need to create collectibles with a win condition by the minimum, I would also like to add a lose state if the zombie catches up to the player and give the player a weapon to defend themselves.

Leave a comment

Your email address will not be published.