Thank you everyone for 2k Subscribers on LeMaster Tech YouTube! In the recent user poll on the channel you all voted for Pacman to be the next big project we take on, so here we are!
All code and assets for the project can be found here:
https://github.com/plemaster01/Python...
If you like this project and want to become a super supporter of the channel consider checking out my Patreon!
/ lemastertech
Check out my personal channel for fun engineering content!
/ @peterlemaster8310
BUY A COOL SHIRT WITH MY LOGO IF YOU WANT TO: https://lemastertech.myshopify.com
If you want to watch the channel of how to build a tilebased level editor check it out here:
• How to Code a Level Editor Using Pyth...
Pacman is one of the most famous and popular games of all time and learning how to recreate the entire game linebyline is something I'd always wanted to do, and once I figured it out I wanted to share it with you, the viewing public!
We start by creating a massive array representing the board tiles for the Pacman level, then draw each tile onto the board algorithmically. Then we draw the player onto the screen and animate him so he has the classic munching pattern!
Next we create player movement with the arrow keys, handle player 'eating' the dots and the powerups, then add scoring.
Finally we create a python class for the Ghosts to share some core functionality! This involves drawing each of their images onto the screen, checking for collisions with walls and seeing what directions are valid for chasing down pacman!
One of the most challenging aspects to this project is giving each ghost a unique pattern of pursuit when chasing down Pacman and we show how to do that entirely from scratch as well!
As always if you have questions, comments, or want to let me know what you want to see more of on the channel, leave me a comment below!!
As always, thanks for watching and good luck with your projects!!
TIMESTAMPS:
00:00:00 Intro and Project Showcase
00:03:40 Setting Up Pygame
00:09:31 Designing a Tilebased Board
00:15:00 Drawing Each Tile Type onto the board
00:40:32 Drawing and Animating the Player onto the screen!
00:51:30 Directional Commands Using Arrow Keys
00:56:06 Check for Player Collisions with walls and allowable turns!
01:17:40 Move the Player! Setting Up 'Joystick' Type control
01:32:10 Scoring and 'Eating' The dots and powerups!
01:41:05 Setting up powerup active timer
01:52:38 Loading ghost images and setting up the Ghost Class!
02:18:05 Check for Ghost valid pathing and turn checking!
02:35:17 Set up a first Ghost Movement Pattern! (Clyde's)
03:03:10 Change Ghost targets based on Game conditions!
03:16:28 Get ghosts to pass through 'Ghost Cage' Door
03:21:13 Colliding with ghosts to eat them and lose lives!
03:36:08 Reset if Ghost is dead when they enter ghost box
03:39:23 Giving the ghosts varying speeds based on game conditions
03:47:17 Scoring points when eating ghosts
03:50:52 Creating Blinky, Inky ad Pinky's Distinct Movement Patterns
04:10:51 Game Over and Game Won Restart Conditions!
04:28:50 Outro and Thank you!!