Code Snippets / Screen Shots

Functions Without Parameters

battle() Function

This function does not have parameters, since its main purpose is to decide the enemy that the player will battle each time an enemy is defeated,

as well as starting off each battle. For example, this function will fade in the cave area, along with the first enemy you will face.
It will decide base enemy stats (e.g. the enemy's health), but not as in depth as the enemyAttack() function. The function also starts off
the battle visually by creating a fade in transition, as well as showing how many enemies you have left to fight in each wave using a label
in the top center of the screen. Overall this functions main purpose is to decide the enemy's the player will face on a case by case basis
by selecting a random enemy from an array, which will depend on the enemy wave the player is fighting.

enemyAttack() Function

This function does not have parameters, since its main purpose is to create the enemy's attack phase. This function will look to see
which enemy has been selected to fight the player (from the battle function) and will create random stats with a specific range based on
that enemy. This function also process the player's move choice, and will change the enemy's health based on the player's move.
This function will also change a label to communicate to the player what is going on in the battle (e.g. how much damage the enemy did to you, etc.).
In conclusion, this function makes up the base of the turn based battles.

Functions With Parameters

walking() Function

This function has a parameter that will tell the function how many seconds for the walking animation to be active. This walking
animation consists of the background zooming in to give the illusion of movement, as well as changing the hands from a static image to a
moving gif. This function also must decide if the player has bought the wooden spear or not, so that if they have the game can change all
of the hand's appearences to be holding the wooden spear.

Functions Without Parameters With a Return

nameGet() Function

This function will accept a string from the player through a text input box, and will return a version of that user's name which will be
trimmed as well as the first letter being turned into an uppercase letter (if not already done so). This is so that the name can
be displayed in the player's "BAG" along with their stats (e.g. health, attack, etc.).

Functions With Parameters With a Return

upperCaseName() Function

This function will take the string returned from the nameGet() function (as the parameter), and will captalize all the words in the name. For instance,
instead of "the king christoph" being turned into "The king christoph", it will be turned into "The King Christoph" with capitals at each
of the seperate word's beginnings. Thus the new version of the name will then be returned.

shopping() Function

This function has a parameter named currency which will enable the function to either use the player's gold (through the global gold variable),
or for testing purposes this function could also use a specific set number of currency (to help test this game easier). This function
will use that amount of currency and create a scene for the player to shop and buy items or weapons that they may want to prepare them
for battle. Once the player has bought what they wanted and exited the shop, this function will also return the amount of gold (or currency)
that the player has left so that they don't have an infinite amount of gold.

String Functions

String Functions in the nameGet() & upperCaseName() Function

Most of the string functions are used in these two functions. In the first function nameGet(), we make use of the trim() function so
the layout of scenes in our game won't we distrupted by a player name with a large amount of spaces at the end. We also use the charAt()
function to specify that the first character of the string is what we want to capatilize using the toUpperCase()function so the player's name is written and
displayed properly. Once we have the captalized first letter, we add it to the rest of the string using slice().
The next function upperCaseName() not only uses most of the previous string functions, but also uses substr() so that we can add the newly
capatilized words to the player's name string (nameOfPlayer).

Arrays

Enemy Array

Since we wanted to have a list of enemies that you are able to fight, our group decided to store the enemy IDs in an array, so that
we could create a random number generator which would randomly pick an enemy from the array for you to fight.

Array + Bubble Sorting

Spear Strike Array

We wanted to implement a move in our game which would do more damage the more you used it and reset once it reached a high number
of damage. To code this, we decided we would create a random list of numbers (an array) and then bubble sort them. Since they are bubble sorted, we
would then create a counter which would keep track of how many times you've used the move, and would have the attack do the amount of damage
as whatever the array's element value is at the position of the counter's value (e.g. array[counter]). Thus, the damage output of the
spear strike would steadily increase as we intended combining bubble sorting with an array.