Week 6 Dev Log (13/11/2022 – 20/11/2022)


Overview Of This Week

This week I managed to complete all my basic/stretch goals apart from the hybrid spells mechanic. I even added extra things such as each zombie variants having different stats which wasn’t planned for this week. It has been a very successful week.

Coding Project: Zombie Killer Boom Boom

So many things have been added this week it is hard to document them all. However, a general look of how they are will be shown.

Health and mana mechanic

Health And Mana UI

As seen in the image, I added a UI for the health and mana. This is stored in a class that holds an object that decreases or increases when the zombies hit the player. This will be shown below:

Health And Mana

I used a constant variable to set the max health and mana which could be balanced later if desired. I didn’t want the health to go over the values set. These variables are global and are compared to check when the player collects a mana star for example. The object held within, “extraStats” constantly changes after the values are set.

Zombies

A lot has been worked on the zombies this week. I made different types of zombies. There are now a total of five. Four of which have a resistance to a certain type of spell. The zombies now follow the player constantly and spawn randomly on each round.

Types Of Zombie

There are four new zombies this week: basic zombie, fire zombie, electric zombie and the earth zombie. I have a class called game manager that helps with the setting of each new zombie. Since there will be a lot to show, I will only show the methods that are called by this class. This will also show the different properties of each zombie:

Type of zombies part 1
Type of zombies part 2

As shown above, when this method is called, a random number is passed as an argument and is used in a switch case to determine which zombie will spawn. I added a default to show me if I inputted the wrong value as I was working out how to use the Math class from the Phaser framework.

Wave Mechanic

Above I talked about the Game manager class which holds the important information to be passed to other classes. This section will show how the round will be incremented as well as how it affects the world state.

Firstly, all zombies are checked if they are dead. This is known when the array that holds instances of the zombie class is equal to 0.

Checking If All Zombies Are Dead

The boolean value which is held within the object of “managingZombies” called “all_Zombies_Dead” is set to true. This value is important as it allows for new zombies to be initialized the next round. The “next_Round()” method will be called which is within the game manager class:

Next Round

The explanation within the code is self explanatory. However, the “currentRound” is a global variable which is used in the text box to show the player what round they are currently in. The next round will then begin and two more zombies will spawn in the next frame.

Zombies following player

I was surprised by how easy this was to implement. This is because Phaser has a very intuitive method that allows an object to move to the desired location. The game manager calls this method within the zombie class (called “Zombie_Man” within the code). This is the method:

Moving towards the player

the “this_Exact_Zombie” property holds the zombie game object that will move to the co-ordinates of where the player currently is. The zombie will go at a certain speed depending which type of zombie they are.

Extra Things I Have Learnt Or Problems I Have Solved This Week

I have done a lot of extra challenges and solved many problems. However, I will talk about the one I am most proud of which is the bit flag I created.

Coding Project: Zombie Killer Boom Boom

Zombie Resistances and the use of a bit flag

I made each zombie resistant to particular spells. For example, the electric zombie being immune to the electric spell. I decided on using a complex algorithm called a bit flag which uses the bit values of objects which then uses an and gate to determine if the value shares the same 1’s. Before even implementing this, I used a flow chart to determine what I will do:

Flow Chart

I then used this to structure the bit flag. The first step was to check which spell had been pressed. This was simple as I had a global array that had a Boolean array that would turn true whenever a spell was pressed and the index correlated to the specific spell. e.g the second element would be the fire spell. A for loop in the game manager checks if each instance of the zombie is overlapping with the spell:

Checking Collision

This would check every potential spell that the zombie could be hit with. Each instance of the zombie, if hit, will push a binary value to an array. This method doesn’t check to resist but checks if it is hit. The resistances are already set when the zombie is initialized. The possible resistances for the zombie are: 0,1,2,4,8. There is another for loop in the game manager which then acts upon the zombie being hit. It will go to the specific zombie instance and then use the method within the zombie class to check if the zombie is resistant to the spell or not:

The game manager constantly calls if the zombie is losing health. This is what the method within the zombie class looks like:

Checking to lose health

The explanation with the code explains it quite well. The “resisting_Attack()” method will be called within the zombie class to check if the zombie is resistant or not. The method will be shown below:

Resisting spell or not

The code explains how the comparison of the denary values work when converted into a binary value to and gate.

Plans For Next Week

Unfortunately, I wasn’t able to implement the hybrid spells this week. I won’t have enough time to try and implement this game mechanic before testing which means it will have to be implemented after the 25th. Apart from that problem, I completed everything I planned for this week. All that is left is to implement a game over screen and a title screen which has instructions to help the player understand the basics to the game. I will mostly be conducting my questionnaires and writing my report on how the prototype has went.


Leave a Reply

Your email address will not be published.