Thursday, 18 June 2015

Pellets

I have made a pellet sprite with a width and height of 8 so it is a very small image that is a white circle looking like a little pellet that pacman can eat. As I am going to have a question for each level which will be set up later on I have made an A - D big pellets which are about the size of power pills. I'm not doing power pills or cherries so that my game isn't identical to other people's games. I will have each answer pellet in each 4 corners. I have a big circle with the correct letter inside it. I have made objects for the pellet but all the actions are in the pacman object.
I have just used drag and drop functions of game maker. There is no coding in this section. The event in pacman object is with the pellet and everytime the pacman collides with a normal pellet the score is set relative to 20 which means 20 points are added to the score when a pellet is eaten. It then tests the instance count equal to one and then setting two variables, the first one being global.gameover to true which is game over as well as another variable global.can_move to false because the game is over. The aliens will then be destroyed and create the message object which will say game over and then it is destroyed and the game will be over. I have also added in a section about getting extra lives but I can't get it working so I am ignoring that section. See below the functions that I have just explained.

I have made a message sprite that has three message, "READY" "CLEAR" "GAME OVER". Dependant on what the situation is it will display the correct message. I have taken the pacman object out and made the message object which have alarms on each message so for each message it will do something different. 


Message "CLEAR"
 In the message object I have tested the variable global.gameover equal to true and then for the clear message I have tested the pellet is equal to 1 and if it is I have changed the sprite to a sub image 1 which is the clear message and I have also set up an alarm to do 60 steps. I have then added a alarm event that will check to see if there is another room after the current room, if there is then set the variable global.gameover to false because the game isn't over and go to the next room. If there isn't another room next then destroy the control object which I will explain in a future blog once I have set it all up as I have only set up the object as of yet. I will then go to the menu room.


Message "GAMEOVER"
In the message object I have tested the lives count and if there is no more lives left then change the sprite to sub image 2 which is the game over message and then i have an alarm to do 60 steps. I have then added an alarm event which destroys the control object and goes to the menu room. 

Message "READY"
In the message object under the clear and game over actions i have an ELSE action and changed the sprite to sub image 0 which is the ready message and then created the pacman object and then an alarm to do 60 steps. In the alarm event for this message I have set the varaible global.can_move to true so the pacman object can move about as well as an alarm to activate the aliens to move with a number of just 1 step as well as destroying the message object.

No comments:

Post a Comment