Useful Links
Computer Science
Game Development
Game Development with Python and Pygame
1. Foundations of Python and Pygame
2. Core Pygame Concepts
3. Handling User Input and Events
4. Working with Images and Sprites
5. Movement and Animation
6. Collision Detection
7. Sound and Music
8. Text and User Interface
9. Advanced Game Structure and Concepts
10. Performance Optimization
11. Project Organization and Distribution
12. Complete Game Examples and Projects
Core Pygame Concepts
The Basic Pygame Program Structure
Importing and Initializing Pygame
Import Statements
pygame.init() and Module Initialization
Checking Initialization Success
Creating the Display Window
Setting Window Size
Setting Window Title and Icon
Display Modes and Flags
The Main Game Loop
Loop Structure
Loop Termination Conditions
Quitting the Game
Handling Exit Events
Cleaning Up Resources
pygame.quit() Function
The Game Loop in Detail
Handling Events
Processing the Event Queue
Responding to User Input
Event Filtering
Updating Game Logic
Updating Object States
Managing Game Timers
Physics Calculations
Rendering Graphics
Clearing the Screen
Drawing Game Objects
Flipping and Updating the Display
Surfaces and Rects
Understanding Surfaces as Canvases
What is a Surface
Surface Pixel Formats
Surface Flags and Properties
Creating and Manipulating Surfaces
Creating New Surfaces
Loading Images into Surfaces
Copying and Sub-Surfacing
Surface Blending Modes
The pygame.Rect Object for Position and Size
Creating Rects
Rect Attributes
Rect Coordinate System
Moving and Manipulating Rects
Changing Position
Resizing Rects
Rect Methods and Operations
Rect Collision Properties
Colors and Drawing
Representing Colors
RGB Color Model
RGBA and Alpha Values
Defining Colors in Pygame
Color Constants
Filling the Screen with Color
Using Surface.fill()
Partial Fills with Rects
Drawing Primitive Shapes
Rectangles
Drawing Filled Rectangles
Drawing Outlined Rectangles
Circles
Drawing Filled Circles
Drawing Outlined Circles
Ellipses
Drawing Ellipses within Rects
Polygons
Drawing Arbitrary Polygons
Lines
Drawing Single Lines
Drawing Multiple Lines
Line Width and Anti-Aliasing
Arcs
Drawing Arc Segments
Controlling Time and Frame Rate
The pygame.time.Clock Object
Creating a Clock Instance
Using tick() to Control FPS
Capping the Frames Per Second
Setting a Target FPS
Monitoring Actual FPS
Understanding Delta Time for Frame-Independent Movement
Calculating Delta Time
Applying Delta Time to Movement
Time-Based Events
Using pygame.time.get_ticks()
Creating Timers
Previous
1. Foundations of Python and Pygame
Go to top
Next
3. Handling User Input and Events