Blog Archive

Monday, 14 December 2015

Assignment 2: Shapeman Game

Assignment 2: Creating a Game

Game Sketch


Spritea
















Objects






Player Object (Obj_player)







The <left>, <up>, <right> and <down> events enable the player to move the character in those respective directions. Within each of the collision events with the different shapes (obj_circle, obj_tri, etc.) there is action to turn the player into the shape in which they collide with. The collision with the wall object simply sets the players speed to 0, in order to stop the player when they collide with a wall.

Within the collision there is code which allows the core aspect of the game to work.
In the code for the collision with the enemy object, it states that if the sprites of both the enemy object and the player object are the same, then the enemy object is destroyed and your score is increased by 20. However, if the sprites are not equal to each other then it sets the death to true, in which death a variable that signifies the player has died. In the code you can see that if the variable death is true, then the player loses a life and the game creates a white explosion above the player, and then proceeds to destroy the player object and then recreate it back at the start point

Enemy Object (Obj_enemy)


In the create event there is a small bit of code that helps with the movement of the enemies within the game and allows them to move randomly around the room.
The code sets the speed of the enemies to 1.5, with the addition of a random number between 0 and 2, to make sure that the game enemies have a random speed when they are created. The second line of code sets the direction of the enemy to a random direction in a circle, hence the random number from 0-360, which is the angles in a circle. The alarm ticks down from 50 and random number between 0 -150, and when this number reaches 0 the enemies change to a random direction to help keep the game unpredictable and challenging.



In the alarm event it just shows that when the alarm reaches 0 it changes the direction to any direction in a circle, and then resets the alarm to a random amount.




The step event is where the code is to make the enemy objects switch their sprites. In the switch statement, it changes the variable spriteto, which is the next sprite the enemy will be changing to. In the cotroller object, spriteto is set to irandom(4) which means that it could represent any number between 0-4, therefore in the switch statement, each case is a number between 0-4. What the code in the step event is saying is that if the random number for spriteto is 0 for example, then the statement checks case 0 to see which shape the enemy sprite should turn into. In case 0, it sets the sprite index of the enemy to a circle, and so on for each different shape that is in the game.



The collision with the wall just sets the enemy object to bounce off in order to stop them either getting stuck at the wall, or just not moving when they reach it.


In the draw event of the enemy object, it is very similar to the step event, as this event just draws the sprites into the game after the step event has worked out which sprite it is meant to be. Without this code the enemies do not appear within the game even though they have been placed in the room due to the fact that their new sprite cannot be drawn into the game when it is changed through the step event.

Controller Object (Controller)







In the create event of the controller, I set the variables that would be used throughout the game in other pieces of code. Gameticks is the number that the countdown will start at each time, and decreases by one after each cycle of the countdown, in order to make the game slightly more difficult each time as it makes the countdown shorter. Lives is the amount of lives you have in the game, and every time you die they decrease by one until you are out of lives at which time the game will end and restart. The score will increase every time you destroy an enemy, or you collect one of the collectibles within the game. Spriteto is the sprite that the enemy object is turning into, and spritenext is the sprite that the enemy will changing into next. The death variable is there for when the player object dies, as mentioned earlier. The countdown variable is the time it takes until the sprite changes shape. The game counts down from 200, and when that number reaches less than 2, the enemy objects change their sprite, and the countdown resets to the number in which the gameticks is set at.







In the Step event of the Controller, the first part of the code references the countdown until the sprite changes. The code says that it takes a random number from the gameticks, which is a variable that is set at 200. If that number is less than 50, it lowers the countdown by one. Then code the continues on to say that if the countdown reaches less than 2 then it sets the spriteto variable to equal the spritenext variable, so that the sprite changes it’s shape to the next sprite which was set by spritenext variable. The spritenext variable then resets to a random number between 0-4, which represents a respectve sprite. The countdown then resets to equal the gameticks, which is one less than the original number in order to make the game faster and more difficult.
The next part of the code deals with when the player runs out of lives. If the number of lives that player has is less than or equal to zero then the game shows a game over message, and the game restarts from the start. Finally, the last part of the code in the step event helps that game keep running by spawning more enemies into the game. The code says that if the number of enemy objects is less than or equal to two then it creates four enemy objects in designated coordinates within the room. It continues to do this everytime the number of enemies drops below or equal to two, so the game only ends when the player dies.




The draw event is where the game draws the information into the game. The actions within this event are very simple, they essentially just create lives and score in the game, and then sets the colour and font of the writing in the game.

In the draw event there is a piece of code that creates the number in the middle of the game that represents the shape that the enemy objects will change into next. What the code says that if the next sprite is going to be a circle, then the sprite number is set to 1, which references the number of sides that the shape has. This has been copy and pasted and then changed to work with every different sprite that is in the game, with each number referring to the number of sides that specific shape has. At the bottom this code just draws the countdown, the gameticks and the number into in the game at those specific coordinates.


Life Object (obj_life)




In this code it simply creates an explosion when you collide with the life object, then sets the lives to plus one more than it already was, and then it destroys the life object so the player cannot collect infinite lives and ruin the game.


Collectible Object (obj_collect)






Simple piece of code that says that when the player collides with this collectible, it adds five points onto his score and then destroys the collectible in order to stop the player getting an unlimited score.




Room
This is the room I am using. The number to show the next sprite is shown in the box in the middle, with the score and the lives being shown at the bottom of the screen. The player starts on the left had side of the screen as a circle, and the different shapes that change the players sprite are in each diffent corner of the room, with one at the bottom. The life is on the left hand side of the room, and the collectibles are all over the room.


Watch videos with low volume!

Game Test





Improvements

1. I would like to make the art work better for the game, such as the sprites and the background as they are very basic and boring. I would also like to add more animation for the sprites, and also a way to differentiate the players shape and the enemy’s shapes, especially when they are the same.
2. Another improvement I would like to make to my game is the fact that when all of the collectables have been collected, there is none left. Therefore I would like to find a way to make the collectables respawn, or even just add another room whenever the collectables have all gone.
3. I would like to improve the game by adding a pause menu to the game as it is difficult to stop playing if you have to do something as the enemies can move at random and there is no safe area where the player can go if something comes up and they need to do something
4. Finally, I would like to add a way for the life object to spawn every time the player reaches a score which is a multiple of 200 for example. Currently, there is only one life object which is in the game from the beginning so I would like to be able to find a way to create more of these instances within the game.


Sister Test



My Sister’s Improvements and Thoughts

1. Thinks that there should be more enemies spawning the higher the score gets, for example once you reach 150 points 5 enemies should spawn instead of 4 etc to make the game harder and more interesting
2. Wants there to be more coins to collect, got bored when she had collected all of the coins and felt the game would’ve been better if the coins respawned or if there were more of them.
3. She thought the music fit the game well and enjoy the sound effects, although complained that sometimes the sound effects were too loud or if you got stuck they played constantly.


User Manual

Cover and Manual



No comments:

Post a Comment