C. Program Description for Developers

Memory Game:

The memory game was a game of concentration. It involved using the simpleGameEngine and the retro_card.png, which were both previously provided during class. The game was a matrix of 4 rows and 13 columns, consisting of 26 pairs of cards, which were generated from an index of 21 – 72 (cards in the retro_card.png). The cards were randomly generated and changed after each game, using the command “randperm”, which was supported by the variable cardValues. Additionally, drawScene was used to generate the graphics of the cards. The getKeyboardInput and getMouseInput were used to allow the user/player to click on the screen and have the cards flip over; furthermore, they were used for the user to click the key “q” to end the game or any other key to restart. A while loop was used so that the game would continue generating and getting played until the player hit the key “q”, meaning “quit”. Another while loop was used so that the game would continue looping until all the cards were matched and there were no longer any cards on the screen. Text appeared both at the beginning of the game to explain how to play and on completion of the game telling the number of matches taken, how to restart or quit, and thanks for playing. This involved the use of the “text” command. When using the text command we included a variable before it, such as intro, score, or value. The ending text involved the commands pause and close where the text would be held on the screen for 5 seconds (pause(5)) and then close at the completion of those 5 seconds.

List of variables used:

  • memoryGame – used to declare the simpleGameEngine
  • userInput – to start the loop
  • intro – used to produce intro text
  • intro.Visible – to get the intro text off the screen
  • cardBack – to show the card backings on the screen and what they would look like
  • displayArray – to produce an organized array (4×13) without the cards (blank set of 1’s)
  • cardValues – to add values to the cards as they are just backs
  • cardArray – to produce an organized array (4×13) with the cards
  • numMatches – to show how many matches the player has used in the round
  • score – show number of matches taken
  • options – produces text that tells the user to press a range of keys for different actions they want to take
  • score.Visible – to turn off the previously shown number of matches taken
  • value.Visible – to turn off the string that was made into text
  • options.Visible – to turn off the the text that tells the user the keys they can press for different actions
  • value – taking the the numMatches and converting it into a string to be shown in text

List of provided MATLAB game commands:

Sprite Sheet – A graphic (PNG) that comes from multiple small images. Sprites can be big or small, but must all be the same. Sprite sheets are pre-drawn and saved and then are imported into the Matlab code later on in the order needed. (Used the provided retro_card.png).

simpleGameEngine – Comes from multiple different functions that are compiled into one. Stores the sprite sheets within it along with other data that was used when generating our team game.

drawScene – Displays the sprite sheets by “drawing” them into the code. Used drawScene every time creating a new screen or wanted to display a new image for the game.

getKeyboardInput – Allows the user to control their clicks. Involves the keyboard as the arrows are needed to operated, which can be implied.

getMouseInput – Allows the user to control their clicks. Involves the user clicking on the computer screen to interact with the game.

retro_card.png – Found in the simpleGameEngine. It is a sprite sheet that was used for this game. Sprite sheets and the simpleGameEngine are talked about above.

Used the simpleGameEngine provided and the retro_card.png provided.

Click Adventure Game:

The click adventure game is a game where the user has to find and click on the moon. It uses the simpleGameEngine and spritesheet.png to run. This game is set up by first creating a screen using the background and foreground, and one of them will contain the moon sprite. Then, by using getMouseInput it checks which column and row the user presses and stores that value into the variables r and c, respectively. The command is ran in a while loop to check if the value of r and c equals the value of the r and c where the moon sprite is located. After the user presses the moon they have to do it again on an another stage and following that they win and have the ability to either restart by pressing ‘r’ or quit by pressing ‘q’. There are 2 text commands telling the user the rules of the game and the buttons to press in order to restart or quit.

List of variables used:

  • val – used to set an arbitrary number so the program is forced to run the loop the screens
  • k – uses the waitforbuttonpress command to see what user presses on the keyboard
  • r – find the row the user clicks on
  • c  – finds the colum the user clicks on
  • fg – stand for the foreground and the sprite that will be in it
  • bg – stand for the background and the sprite that will be in it

 

List of provided MATLAB game commands:

Sprite Sheet – A graphic (PNG) that comes from multiple small images. Sprites can be big or small, but must all be the same. Sprite sheets are pre-drawn and saved and then are imported into the Matlab code later on in the order needed. (Created our own)

simpleGameEngine – Comes from multiple different functions that are compiled into one. Stores the sprite sheets within it along with other data that was used when generating our team game.

drawScene – Displays the sprite sheets by “drawing” them into the code. Used drawScene every time creating a new screen or wanted to display a new image for the game.

getMouseInput – Allows the user to control their clicks. Involves the user clicking on the computer screen to interact with the game. The computer responds every time

Used the simpleGameEngine provided and the website PixilArt to create the graphics (sprite sheets) used in the code.