Python 3 PyGame DOS Pacman Doodle Game With Music GUI Script Desktop App Full Project For Beginners

Python 3 PyGame DOS Pacman Doodle Game With Music GUI Script Desktop App Full Project For Beginners

 

Welcome folks today in this blog post we will be building a dos pacman doodle game in python using pygame library. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install pygame

 

After installing this library make an pacman.py file and copy paste the following code

 

pacman.py

 

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
from game import Game

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 576

def main():
    # Initialize all imported pygame modules
    pygame.init()
    # Set the width and height of the screen [width, height]
    screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
    # Set the current window caption
    pygame.display.set_caption("PACMAN")
    #Loop until the user clicks the close button.
    done = False
    # Used to manage how fast the screen updates
    clock = pygame.time.Clock()
    # Create a game object
    game = Game()
    # -------- Main Program Loop -----------
    while not done:
        # --- Process events (keystrokes, mouse clicks, etc)
        done = game.process_events()
        # --- Game logic should go here
        game.run_logic()
        # --- Draw the current frame
        game.display_frame(screen)
        # --- Limit to 30 frames per second
        clock.tick(30)
        #tkMessageBox.showinfo("GAME OVER!","Final Score = "+(str)(GAME.score))
    # Close the window and quit.
    # If you forget this line, the program will 'hang'
    # on exit if running from IDLE.
    pygame.quit()

if __name__ == '__main__':
    main()

 

READ  Python 3 PikePDF Library Script to Extract All Links URLs From PDF Document Full Project For Beginners

 

Now we need to download the full source code of the pacman game using the below link

 

DOWNLOAD SOURCE CODE

 

Now after downloading the source code you will see the directory structure as shown below

READ  Python 3 PyQt5 Script to Draw Polygon Shape Using QPainter Class GUI Desktop App Full Project For Beginners

 

 

 

 

Now if you execute the main.py file inside the directory by the below command

 

python main.py

 

 

Leave a Reply