My Friday Work this week is Pacman game. I’m not done with this game yet. But I drew the map and each tile type of the game onto the screen. And animate the pacman on the screen, and it can move around the map. And I also created a function that allows the pacman to change direction when it hits a wall.
- The code below is set up pygame and it will pop up a screen.


- This code is draw the map and each tile type onto the screen.

- And this is the map look like.

- And the code below is draw the pacman and it can flip, rotate when change direction.


- The image on the left is draw and animated the player. And the other one is make the pacman can flip and rotate.


- And this last code can make the pacman move around and check if it hits the wall and allowable to turn the direction.


- And this is the pacman can move around.


Today I learned how to draw and animate the pacman and how to flip and rotate when it changes direction. And learned how to draw the map of the game, I don’t understand the whole of the code how to draw the map but I understand some of it. And the video below is the tutorial of the pacman game.
No Responses