Friday 19 June 2015

Questions

To start off with I have created a script called randomizeQuestion which will make the answers random. I am showing the debug message of the question object which i have created which will show the questions. In this script I have written it out so that the questions will be displayed and the answers will be randomized and the correct answer will also be shown. I have included a for loop which will show the answer and I have set it up so it will assign and display the answers and question. 
On the answer pellets I have added a create event which assigns that pellet an answer number for example answer pellet A will have an answer pellet number of 0. B will have 1, C will have 2 and D will have 3.


The answer pellet has a pacman collision so when pacman eats the pellet i have code to check to make sure it is the right answer, if it is then it will go to the next level, if it isnt then it will show an error message syaing its wrong. There is also an if statement stating that the control object and the current question will be equal to the number of questions which will end the game or else it will execute the script.  This event is on all the answers pellets.
On the control object it will be controlling and displaying the questions, answers and right answer code. It will load the questions file which has 3 questions in it as well as the answers. It will read the file and add the question on the room as well as the number of questions. It then closes the file and shows the number of questions when you come out of the menu page. It will creare the question object and execute the script.
Also in the create event is setting the lives to 3 so pacman has 3 lives, setting the score to 0 and the variables global.gameover and global.can_move to false as well as setting the variable global.extra_life to 1 although the lives system doesn't seem to work, I'm not sure why.
I have set an alarm up to create and display the message object.

I have set up a draw event and in there i have drawn the lives as a pacman image, set the font to score which is a font i added in the font section which displays all characters. I have set the colour to green and drawn the score in the top right corner which is an x of 630 and y of 1 and the caption is "Score:".

In the pacman object i have created a collision for each answer pellet which all have the pellet object as the parent. If the answer objects are collided with the pacman it will add 50 to the score, i have tested the variable score larger than global.extra_life * 100 then it will add a life and set the variable to 1. If the pellet object is equal to 1 then set the variable global.gameover to true and global.can_move to false which will destroy the parent alien and create the message object. Lastly it will destroy the pacman.

I have created a question object which i have added a create event which I have execute code to display the questions,answers and correct answers.
I have also added a draw event with the actions of setting the colour to red and the font to the score font. Then I have execute code which is the exact placing of the questions and answers text including the correct answer.


Rooms

Menu
I have created a background which is purple with "PACMAN" at the top and i have images of the aliens and pacman as you will see below. I have then saved it and made the menu room and put the menu background in the room.


For the menu room I have created a sprite message saying "PRESS ENTER" which in turn will start the game. I have created an object for that sprite which has a <enter> keyboard event and I execute code that means when the enter key is pressed the menu room will close and the level 1 room will open and start.

I have gone onto the menu room and added in the enter button on the purple background.


Level 1
In level 1 i have the wall object going in a rectangle and making it so there is thin areas apart from the middle bit. I have made boxes and different types of obstacles for the alien and pacman to go round. I have put the answer pellets in each corner I have pellets going all the way round except above the alien. I have the pacman lives in the top left corner and the score in the top right corner which will go up as pellets are eaten. The question is just underneath the score and the answers and correct answer are placed underneath the pacman maze. The alien is currently trapped in the alien box and the message object is in the middle of the maze waiting for the game to begin.



Level 2
In level 3 i have the wall object going in a rectangle and making it so there is thin areas as well as areas that have no walls between pellets. I have made different types of obstacles for the aliens and pacman to go round. It could be quite easy to get trapped. I have put the answer pellets in each corner I have pellets going all the way round. I have the pacman lives in the top left corner and the score in the top right corner which will go up as pellets are eaten. The question is just underneath the score and the answers and correct answer are placed underneath the pacman maze. There are all 4 aliens in this level and only one alien is currently out of the alien box, the others are currently trapped in the alien box and the message object is in the middle of the maze waiting for the game to begin.


Level 3
In level 3 i have the wall object going in a rectangle and having wall openings so the pacman and aliens can go in and out of the maze and to different areas. I have made boxes and different types of obstacles for the aliens and pacman to go round. I have put the answer pellets in each corner I have pellets going all the way round except above the alien. I have the pacman lives in the top left corner and the score in the top right corner which will go up as pellets are eaten. The question is just underneath the score and the answers and correct answer are placed underneath the pacman maze. Two aliens are out of the alien box and the other aliens are currently trapped in the alien box and the message object is in the middle of the maze waiting for the game to begin. I have 5 aliens in this maze so it gets a little bit trickier to reach the right answer pellets. Once this level is done it shuts the program down.  


Testing

This is my testing which I have changed my test plan a little bit as I forgot to include the questions and I have made the game a little different to my design because of time and I struggled with parts of the game. I have evidence screenshots below. I have failed some of the tests. 









Aliens


I have created 4 aliens. One red, one orange, one pink and one blue and on the sprite image I have erased the background of the aliens and the height and width is 32x32. I have created an object for all the aliens but I have also created a parent alien object because there are alot of actions in the aliens movement so it is easier to have a parent alien and have all the actions there and make the normal alien object have a parent of parent alien object so all the action will be for each alien without having to copy and paste the actions in each alien. The parent alien object i have the wall sprite as the sprite for this object so that the aliens wont go through the walls.

In the parent alien object I have added a create event and in that event i have set the alien_speed variable to 0 and the which_way varaible to 0. theses varaibles that i have set up are used in the other events that control the speed of the aliens and which direction they will go. I have also got the alien to move left, right, up and down fixed moving. 



I have set an alarm event and in that I have set the variable alien_speed to a value of 4 which is what the aliens speed will be when they move. 


I have made another event which is an End step so this will be used last out of the process. In this event I have alot of actions which is starting off to check the aliens are on the grid and testing the global.can_move variable to see if the aliens are able to move which is set to true so they should be able to move.
The next set of actions are moving freely in the direction with a speed of alien_speed. I have set the variable which_way to 0 and then tested the variable vspeed (vertical speed) is equal to 0.
First off I am going to do the horizontal direction, the vertical will be almost identical but it will have different values for the direction.
I have checked the object wall and i have set it up so it's x is x + hspeed (horizontal speed) and the y is just y. I then have set a variable for which_way set to 3. I then check the wall object again but with an x of x and a y of y + alien_speed. I then have the which_way variable set to 1. Next I have done the checking wall object with an x of x and a y of y - alien_speed and the variable which_way is set to 5. These positions all decide which way the alien goes. I then exit the event. I then set a variable direction to an angle of 270 and exit the event if which_way is equal to 1. If it is equal to 5 it will do the same but the direction will be 90.  If which_way is equal to 4 it will test the chance and choose 1 out of 2 directions to go and check the barrier object and set the direction to 270 and then exit the event.




If which_way is equal to 8 then it will do the test chance of 2 sides, set the variable direction to 90 and exit the event. If which_way is equal to 6 it will test the chance of 2 sides,set the variable direction to 270 or else it will set the direction to 90 and exit the event. If it is equal to 9 it will test chance of 2 sides and exit the event otherwise it will test the chance of two sides and set the direction to 90 or else it will set the direction to 270 and exit the event. If it is equal to 0 it will set the direction to 180 and exit the event. This is the end of the horizontal movements.
I have put in an else action. The vertical movements are exactly the same apart from the angle will be different so the check wall object will have an x of x and a y of y + vspeed. The second check wall object will have a of x + alien_speed and a y of y. The last check wall object will have x of x - alien_speed and a y of y. The rest is exactly the same as horizontal but some of the angle have changed for example the which_way equal to 0 rather than 270. Which_way equal to 5 will be 180 instead of 90. which_way equal to 4 will be 0 instead of 270. Which_way equal to 8 will be 180 instead of 90.
Which_way equal to 6 will be 0 else 180 rather than 270 else 90. Equal to 9 will be 0 else 180 rather than 90 else 270. Equal to 0 will stay as 180. I have then put some end blocks. I have put these in blocks so i don't get terribly confused on what is what and for which direction. That is the movements decision making complete.


For the aliens not to go into the wall along with making the parent the wall i also need to have a collision with the wall object to make the alien go either left,right, up or down when it hits the wall so in other words if it hits a wall it will go in a different direction.

The last one is the outside room event so if the alien goes out the room i have the action wrap in both directions so the aliens will come back onto the maze in a different area (through the tunnels).


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.

Friday 8 May 2015

Pacman background and Pac man.

Giving credit to GhazWorks who created a pacman game. GhazWorks PacMan Game  He has done 10 videos based on making pacman. I will be changing and adding things to try and make it my own program but I will follow this tutorial to get the game all working.
I found a series on YouTube that shows you how to make pac man in Game Maker but none of it is executing code. It is all drag and drop functions so I am still doing a bit of research to figure out how to code the game properly. I have created a pac man animation so the pac man's mouth opens and closes as if it is eating which then starts again when an arrow key is pressed. It is only the arrow keys that are being pressed in this game. I have created a blue wall and the aliens sprites.
I used coding to stop the animation when no key is entered which is as follows...




I have made a wall sprite and a barrier sprite which i have made a object for both but on the wall object I have made the barrier object the parent so the barrier's actions will be the same for the wall. I have made a pacman object which I have a collision with the barrier object and in that event the pacman is checking the grid and if the pacman or the alien that i will be setting up later collide with the wall/barrier the pacman/alien will stop/move in a different direction.
I have made 4 pac man sprites which are looking in different direction so in the pacman keyboard events for left, right, up and down it will change sprite to the correct direction for example, left will test the global.can_move variable which is testing whether the alien can move or not then if the instance is aligned on the grid then it will change the sprite to pacman_lft and start moving left.

I have made a test room with a wall on the edges and making a little bit of a maze and I have a little pacman in the middle of the room. When i move right it moves, when i move left it changes direction and moves left, when i move up or down it changes the sprite either up or down and goes in that direction. I have got my background environment working correctly. 



Tuesday 28 April 2015

Research pacman game

I have now completed the first part of the assignment which is the designing, this includes the description of the game, who its aimed at, how it will help them, the storyboards of the game and the test plan for the game. I have also upload my Individual action plan which is which i need to follow to stay on top of the work.This week I am researching how to make Pac Man on Game Maker.