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.