Program Arcade Games
With Python And Pygame

Language
English
Dutch - Nederlands
French
Hungarian - Magyar
Portuguese - Português
Russian - Русский
Spanish - Español
Turkish - Türkçe

Download all these examples along with supporting files in a zip file: python_examples.zip.

Lab 17: Pygame Graphics Examples

Base template screenshot
This opens up a blank pygame window. It is a good template to use when starting a new program. (Chapter 5)
move_keyboard.png
This file demonstrates setting up a window and drawing rectangles, polygons, text, and other basic shapes. (Chapter 5)
move_keyboard.png
Demos all the commands in the draw module.
move_keyboard.png
Animate a bouncing rectangle around the screen. (Chapter 8)
move_keyboard.png
This shows how to use an array to animate and track multiple objects. In this case, snow flakes. (Chapter 8)
move_keyboard.png
This file draws a snowman inside of a function. The program can then call the draw snowman function and draw several snowmen easily. (Chapter 9)
move_keyboard.png
Move an object with the mouse (Chapter 11)
move_keyboard.png
Move an object with the keyboard (Chapter 11)
move_keyboard.png
Move an object with the game controller (Chapter 11)
move_keyboard.png
Show how to read everything off a gamepad/controller/joystick. (Chapter 11)
move_keyboard.png
Display bitmapped images (png, jpg) to a screen. Make sounds. (Chapter 12)
move_keyboard.png
Display a board based on a two-dimensional grid. Useful when creating games like tic-tac-toe, minesweeper, memory-match, connect-four, etc. (Chapter 17)
move_keyboard.png
Display one or more pages of instruction before the game starts.
move_keyboard.png
Plays background music. When the music is over, an event is triggered and a different song starts. The music is included in the downloadable zip file, or you can follow the links in the comments to download the music.
move_keyboard.png
Shows how to display a centered "Game Over" message, and stop game play when a game is over.
move_keyboard.png
Display a line sweeping around in a circle like a radar.
move_keyboard.png
Count up and count down timers. (Chapter 21)
Recursive Rectangles
Using recusion to make nested rectangles. (Chapter 20)
fractal
Using recusion to make fractals. (Chapter 20)
cannons
Using Trigonometry (off-site link) - If you want things that bounce, wave, or even pointing cannons, then follow this link to Al Sweigart's page and read up on using trigonometry with your code.

You are not logged in. Log in here and track your progress.

About Buy the Book Help Translate My College My Twitter