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
Handling User Input and Events
The Pygame Event System
The Event Queue
How Events are Queued
Event Queue Limitations
Event Queue Management
The pygame.event.get() Loop
Iterating Over Events
Filtering Events
Event Queue Clearing
The pygame.Event Object
Event Attributes
Creating Custom Events
Common Event Types
QUIT
Handling Window Close Events
KEYDOWN and KEYUP
Detecting Key Presses and Releases
Key Repeat Events
MOUSEBUTTONDOWN and MOUSEBUTTONUP
Detecting Mouse Button Actions
Mouse Button Types
MOUSEMOTION
Tracking Mouse Movement
Mouse Position and Relative Movement
Custom User Events
Defining Custom Event Types
Posting Custom Events to the Queue
Keyboard Input
Reading Key Presses from the Event Queue
Accessing Key Codes
Handling Modifier Keys
Unicode Key Input
Checking for Held-Down Keys
Using pygame.key.get_pressed()
Continuous Movement with Held Keys
Key Mapping and Configuration
Creating Key Bindings
Customizable Controls
Mouse Input
Getting Mouse Position
Retrieving Cursor Coordinates
Screen vs. Game Coordinates
Getting Mouse Button States
Checking Button States
Handling Multiple Buttons
Mouse Cursor Management
Hiding and Showing Cursor
Custom Cursor Images
Joystick and Gamepad Input
Initializing Joystick Support
Detecting Connected Joysticks
Reading Joystick Input
Button Presses
Analog Stick Values
Trigger Values
Previous
2. Core Pygame Concepts
Go to top
Next
4. Working with Images and Sprites