Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Extreme Pygame Programming
Rating: 3.7 out of 5(3 ratings)
71 students

Extreme Pygame Programming

Learn Python by creating classic games like Wolfenstein 3D , Outrun ,Mario-Kart , and a Top Down Shooter style projects.
Created byDion Jackson
Last updated 3/2026
English
English [Auto],

What you'll learn

  • Students will learn Python by creating games using the Pygame module.
  • 4 Major Projects Raycaster First Person Shooter Outrun Style Racing Game, Mario Kart/F-Zero Style Racing Titles then Modern 2D Top Down Shooter in Python.
  • Students will quickly learn how to create assets and structure programs using Object Oriented Programing paradigms essential for software development.
  • Also there will be independent lecture like tutorials for Python and the API Pygame.
  • How to plan and structure a game using some simple free tools to expediate development lifecycle.

Course content

8 sections • 190 lectures • 26h 55m total length
  • Course Overview Python4:07

    A general overview of what is planned to take place during this course on using Python and Pygame.

    Pygame is a popular, open-source Python library used to create 2D video games and multimedia applications. Built on top of the Simple DirectMedia Layer (SDL), it provides low-level access to audio, keyboard, mouse, and graphics hardware while maintaining a beginner-friendly Pythonic interface.

  • Opening a Window15:59

    Create a complex yet simple window using Python.

  • Installing Python IDE and Pygame39:02

    Create a Platformer using Python.

  • VScode Assignment Install Pygame and Project Resources22:36

    See if you can get Pygame Installed for Windows and on VScode for other Operating Systems.

  • Pygame Python Tutorial22:04

    Pygame is a free and open-source cross-platform library for the development of multimedia applications like video games using Python.

  • Pygame Documentation5:39

    The official Pygame v2.6.0 documentation provides a comprehensive reference for every function, alongside tutorials for all skill levels.

  • Coding with Python51:17

    Coding an entire basic platformer using Pygame.


    Why Choose Python?

    Python is a popular choice for several reasons:

    • Its syntax is clear and easy to read, resembling English.

    • It is versatile and used in various fields like web development, data science, and machine learning.

    • Python has a large standard library and a vast collection of third-party packages.

    • There is high demand for Python skills in the job market, especially in tech fields.


  • Easy Snake Game21:05

    Overview of what can be done using Python.


    Key attributes of a Snake class:

    • body: A list or deque of positions (e.g., pygame.Rect objects or (x, y) tuples) representing each segment of the snake.

    • head: A reference to the first segment in body, representing the snake's head.

    • direction: A vector or enumeration indicating the current direction of movement (e.g., (1, 0) for right, (0, -1) for up).

    • color: The color used to draw the snake segments.

    • block_size: The size of each square segment of the snake.

    Key methods of a Snake class:

    • __init__(self, color, pos, block_size):

      Initializes the snake with a starting position, color, and segment size. It typically creates the initial head segment and adds it to the body list.

    • move(self):

      Updates the snake's position based on its direction. This involves adding a new head segment in the current direction and removing the tail segment (unless the snake has just eaten food).

    • turn(self, new_direction):

      Changes the direction of the snake, ensuring that it cannot immediately reverse direction (e.g., cannot turn down if currently moving up).

    • grow(self):

      Increases the snake's length by adding a new segment at the head's previous position without removing the tail. This is called when the snake eats food.

    • draw(self, surface):

      Renders the snake on the given Pygame surface by drawing each segment in the body list.

    • check_collision(self):

      Detects collisions with the game boundaries or with the snake's own body segments, returning True if a collision occurs.

    • get_head_position(self):

      Returns the current position of the snake's head.

    • reset(self, pos):

      Resets the snake to its initial state, typically used after a game over.

  • Game math 14:38

    Develop an understanding of game math in Python by building a calculator that uses random operators and operands, validates results with tolerance, and demonstrates quick arithmetic checks for games.

  • class activity working with multiple files in python7:37

    A class activity working with multiple files in Python typically involves two main concepts:

    1. Code Organization: Splitting a large project into multiple .py files (modules) to improve readability, maintainability, and reusability.

    2. Data Processing: Reading and processing data from multiple data files (e.g., text, CSV, or image files) programmatically

  • install pygame from the documentation7:16

    To install Pygame, the recommended method from the documentation is to use the Python package manager,

    pip, in your terminal or command prompt

  • Creating Project Resources and Free Tools1:03:50

    First thing will be to learn where  to get free open source tools for making graphics and sound effects. Then learn how to use the tools to create sprites and maps for our game projects. Creating project resources involves leveraging various tools for planning, tracking, collaboration, and design. A wealth of free software options exists to support these efforts for individuals and small teams

    .

  • Data structures overview1:15:26

    Python provides a variety of built-in and specialized data structures for efficiently organizing and storing data

    . The choice of data structure impacts performance, scalability, and memory usage for different tasks.

  • Platformer Project Overview52:29

    Key Components of an Animated Platformer Project

    • Character Animation:

      • Sprite Setup: Import character sprites (idle, running, jumping) and configure them as Sprite 2D and UI in the editor.

      • Animation Controller: Utilize Mecanim (Unity) or AnimationTree (Godot) to create smooth transitions between animation states based on parameters like speed and vertical velocity.

      • Blend Trees: Use blend trees to manage complex movement transitions, such as blending between walking and running.

    • Player Movement & Physics:

      • Movement Script: Develop code to manage character movement, ground detection, and jumping using rigidbodies and box colliders.

      • Input System: Utilize a modern input system to handle player controls efficiently.

      • Collision Detection: Implement specialized collision boxes for different character states, such as crouching, to ensure proper interaction with the environment.

    • Level Design & Environment:

      • Tilemaps: Utilize Unity's tilemap system to paint levels with terrain, hazards (lava, spikes), and items.

      • Prefab Utilization: Create prefabs for reusable elements like coins, enemies, and platforms to enhance efficiency.

    • Game Management:

      • UI/HUD: Implement a heads-up display to show score, health, and menus.

      • Scene Management: Handle game states like reloading the scene on player death or moving to the next level.

  • Animate the Player from a SpriteSheet3:34

    Animating a player from a spritesheet involves loading the image into a

    Sprite2D node (set to "Nearest" filtering to avoid blur), defining horizontal/vertical frame counts in the Inspector, and using an AnimationPlayer to keyframe changes in the frame property. Loops can be enabled for animations like "idle" or "walk".

  • clickable game menu system2:00


    Creating a clickable menu system in Pygame can be done either by writing custom button logic using basic Pygame functions or by using an external library like

    pygame-menu or Pygame GUI.

  • Assignment GameOver Screen2:05

    Creating a "Game Over" screen in Pygame typically involves using a game state manager (often a simple variable) within your main loop and a dedicated function to handle the display and user input for that state.

  • Health Bar with Numbers2:49

    To create a health bar with numbers in Pygame, you need to combine two core functionalities: drawing the visual health bar using pygame.draw.rect and rendering the health text using a pygame.font.Font object.

  • boomerang3:05

    Implementing a boomerang in Pygame involves managing its unique movement: throwing it in one direction and having it return to the player.

  • Enemies Spawn Moving from Left to Right5:48
    1. Define the Enemy Class: Inherit from pygame.sprite.Sprite, setting the initial x position off-screen left and randomizing the y position. In the update method, increase self.rect.x to move them to the right, resetting their position when they exit the right side of the screen.

    2. Manage with Groups: Create a pygame.sprite.Group in your main script to hold all Enemy instances.

    3. Update and Draw: Inside your main game loop, call enemies.update() to move the enemies and enemies.draw(screen) to display them, maintaining a consistent framerate.

  • Moving the Elevator2:54
    1. Coordinates: In Pygame, the top-left corner is (0, 0), so moving up means decreasing the y value, and moving down means increasing the y value.

    2. Game Loop: All movement logic must reside within the main game loop, where the position is updated each frame.

    3. Speed/Velocity: A velocity or speed variable determines how many pixels the elevator moves per frame, allowing for smooth animation.

  • Enemy Spawn3:03

    In Pygame, enemy spawning typically involves an Enemy class, a container (list or pygame.sprite.Group), and logic within the main game loop to handle creation and updates. You can spawn enemies at random locations, at intervals using timers, or based on game events

  • Elevator on Command2:25

    Creating an elevator system on command in Pygame involves managing movement and user input within the game loop. It's essentially a state machine that moves an object between defined y-coordinates (floors) based on requested floor numbers

    .

  • inheritance using a platformer7:36

    Inheritance in a platformer allows creating a base entity class (e.g.,

    Enemy) for shared properties like health and physics, with specialized child classes (e.g., FlyingEnemy, WalkingEnemy) overriding specific behaviors. It reduces code duplication by enabling child objects to use base methods for movement, combat, or interactions.

  • scrolling background5:07

    The technique relies on having a seamless, tileable background image.

    1. Load the image and get its dimensions.

    2. Use a variable to track the current scroll position (e.g., scroll_x or scroll_y).

    3. In the game loop, decrement or increment the scroll position variable each frame to create movement.

    4. Draw (blit) the image twice:

      • First blit at the current scroll position.

      • Second blit immediately following the first (e.g., at scroll_x + image_width for horizontal scrolling).

    5. Reset the position when the first image moves entirely off the screen (e.g., when scroll_x <= -image_width, reset scroll_x to 0). This creates a continuous loop.

  • shooting more than three missles5:41

    To shoot more than three missiles (or bullets) in Pygame, you must move away from using individual variables for each missile and instead use a list or pygame.sprite.Group() to manage an unlimited, dynamic number of projectiles.

  • Pygame Color5:24

    Common Colors


    • BLACK = (0, 0, 0)

    • WHITE = (255, 255, 255)

    • RED = (255, 0, 0)

    • GREEN = (0, 255, 0)

    • BLUE = (0, 0, 255)

    • YELLOW = (255, 255, 0)

  • Pygame Font7:04

    Pygame handles fonts and text rendering through its pygame.font module (or the more advanced pygame.freetype module), which must be initialized after pygame.init(). Text is rendered onto a Surface object, which is then "blitted" to the screen.

  • Platformer Slope Assignment6:25


    Pygame platformer requires specialized collision detection that moves the player vertically when moving horizontally against a sloped tile, effectively treating the slope as a ramp. Key techniques include checking for collisions by predicting the next position, using slope-specific hitboxes, and adjusting the player's -position based on the relative -position within the tile, often using a "slope acceleration" approach.

  • Pygame Transform10:55
    1. Scale: Use pygame.transform.scale(surface, (width, height)) to resize an image to a specific resolution.

    2. Rotate: Use pygame.transform.rotate(surface, angle) to rotate an image counterclockwise by a given degree.

    3. Flip: Use pygame.transform.flip(surface, flip_x, flip_y) to mirror an image horizontally or vertically.

    4. Smooth Scale: Use pygame.transform.smoothscale(surface, (width, height)) for higher-quality resizing that reduces pixelation.

    5. Rotozoom: Combines scaling and rotation with filtering for smoother edges using pygame.transform.rotozoom(surface, angle, scale).

  • Play Sound on Player Jump1:23

    To play a sound when your player jumps in Pygame, you need to use the pygame.mixer.Sound object. Load the sound effect during your game's setup phase and then call its .play() method within the code block that handles the player's jump logic.

  • Pygame Time3:55

    In Pygame, time management is handled by the pygame.time module, which is primarily used to control the game's frame rate and track the time elapsed in the game. The core component for most game loops is the pygame.time.Clock object.

  • Pygame Event8:01

    A typical Pygame program uses a main loop (often a while True loop) that iterates through the event queue in every frame to check for and respond to events. The primary function used for this is pygame.event.get(), which retrieves all pending events and clears the queue.

  • Pygame Display22:31

    The pygame.display module provides control over the Pygame window or full-screen display. It is the core component for visualizing graphics and user interfaces in a Pygame application.

  • pygame key4:13

    Master pygame.key to read keyboard and button presses, using get_pressed, key states, modifiers, and scan codes, with example documentation and cross-input support for keyboard, touch, mouse, and gamepad.

  • Pygame Draw14:51

    The pygame.draw module provides functions for drawing simple graphic shapes like rectangles, circles, lines, and polygons onto a Surface (such as the game window). All drawing operations require the surface to draw on, a color (as an RGB tuple or color name string), and parameters specific to the shape.

  • Pygame Surface12:12

    A Pygame Surface is a digital canvas, a rectangular object used for drawing, modifying, and displaying all graphical elements in a game, including images and text.

  • Pygame Rects6:34

    Pygame Rect objects are a fundamental data structure used to store and manipulate rectangular areas in games, essential for positioning, movement, and collision detection. They store integer coordinates and dimensions and offer many utility functions.

  • Pygame Image4:48

    In Pygame, images are handled as Surface objects and displayed using the pygame.image.load() and Surface.blit() functions. The process involves loading the image, positioning it, and then drawing it onto the display window during the game loop.

  • Tic-Tac-Toe Game Classes13:28

    Create a simple A.I. to play a game against.

  • Booleans7:05

    A Boolean data type represents one of two possible values—

    True or False (1 or 0)—and is foundational for decision-making in programming and database logic. These values are used to evaluate conditions, control program flow, and manage binary states such as on/off, yes/no, or high/low.

  • Arrays10:25

    An array is

    a linear, mutable data structure storing a collection of elements of the same data type in contiguous memory locations. They offer

    random access to elements via a zero-based index. Key features include a fixed size upon creation, high cache efficiency, and efficiency for storing and accessing, but not for inserting/deleting elements.

  • Type Conversion3:38

    Type conversion (or type casting) is the process of changing a data value from one type to another (e.g., string to integer) to ensure compatibility in calculations or assignments. It occurs automatically as Implicit Conversion (coercion) by the compiler to prevent data loss, or manually as Explicit Conversion (casting) by the programmer.

  • Class Objects6:34

    Pygame uses class objects to organize game elements like players, enemies, and items into self-contained units with their own properties (attributes) and behaviors (methods). The most important class for game objects in Pygame is pygame.sprite.Sprite.

  • Class Properties6:40

    properties typically refer to the attributes defined within a custom class that inherits from a Pygame base class, most commonly pygame.sprite.Sprite. The Sprite and Group modules expect specific attributes to be present for their functions (like drawing or collision detection) to work correctly.

  • Pygame Data Types5:11
    1. pygame.Surface: This is essentially a digital "canvas" used for images, the screen, and all drawing operations. The main display is a Surface object, and images you load or text you render become Surface objects that can be drawn ("blitted") onto other surfaces.

    2. pygame.Rect: A very important and flexible container for storing and manipulating rectangular areas. It handles positioning and collision detection efficiently and accepts standard Python tuples or lists of (x, y) coordinates and dimensions.

    3. pygame.Color: This class (or a simple Python tuple/list of 3 or 4 integers) is used to define colors, typically in RGB or RGBA format, with values ranging from 0 to 255. Color names or HTML hex strings are also supported.

    4. pygame.event.Event: Objects that represent user input or system events like keyboard presses, mouse motion, or the QUIT command. These have an event.type identifier and other attributes specific to the event type.

    5. pygame.sprite.Sprite: A base class for representing game objects that have an image and a position, which helps in organizing and managing elements in your game.

    6. pygame.sprite.Group: A container class designed to hold and manage multiple Sprite objects efficiently, allowing for operations like mass updates and drawing.

    7. pygame.time.Clock: An object used to manage timing and control the game's frame rate, with methods like tick() to regulate loop speed.

    8. pygame.math.Vector2/Vector3: Classes for 2D and 3D vector mathematics, useful for physics and movement calculations.

    9. pygame.PixelArray: A data type that allows for direct manipulation of image pixel data.

  • Date Formats6:23

    %YYear, full version2024%yYear, without century24%mMonth as a number (01-12)07%BMonth name, full versionJuly%bMonth name, short versionJul%dDay of month (01-31)24%AWeekday, full versionWednesday%aWeekday, short versionWed%HHour (24-hour clock, 00-23)15%IHour (12-hour clock, 01-12)03%MMinute (00-59)30%SSecond (00-59)45%pAM/PM indicatorPM%jDay number of year (001-366)206%zUTC offset+0100

  • Delete File4:31

    To delete a file in Python, you primarily use the

    os module's os.remove() function or the modern pathlib module's Path.unlink() method.

  • Dictionary2:00


    Python dictionary is a built-in data structure that stores information in key-value pairs, allowing for efficient data retrieval and management using unique keys. Dictionaries are mutable (changeable) and, as of Python 3.7+, they preserve insertion order.

  • Python Encapsulation5:40

    Encapsulation in Python is an Object-Oriented Programming (OOP) concept that bundles data (attributes) and methods into a single unit (class) and restricts direct access to some components. It uses underscores (_ or __) to indicate private or protected members, preventing accidental modification and promoting secure, maintainable, and well-structured code.

    Key Aspects of Python Encapsulation

    • Bundling Data: Attributes and methods are grouped together inside a class.

    • Data Hiding: Prevents external code from directly modifying internal object states.

    • Access Modifiers: Python uses naming conventions to define member visibility.

      • Public: Accessible from anywhere (no prefix).

      • Protected: Intended for internal use within the class and subclasses (_prefix).

      • Private: Only accessible within the class itself (__prefix).


  • File Handling in Json8:53

    Python's built-in json module provides all necessary tools for handling JSON data in files, allowing for seamless conversion between Python objects (like dictionaries and lists) and the JSON format. This process is known as serialization (Python to JSON) and deserialization (JSON to Python).

  • platformer jumping6:23

    Implementing jumping in a Python platformer, typically using the

    Pygame library, involves managing vertical velocity and applying a continuous gravity force. When the jump key is pressed, the character's vertical velocity is set to a negative value (moving upward in Pygame's coordinate system), which is then pulled back down by gravity each frame.

  • platformer slopes6:19

    Explore slope handling in a platformer by implementing triangle-based slopes, collision detection, and slope walking, with code examples and debugging tips.

  • lottery slots2:11

    Creating a lottery-style slot machine in  Pygame involves combining graphical elements with a random number generator (RNG) to simulate spinning reels and winning combinations.

    - avoid this video if you have trouble or a history with flashing lights-

  • inner class8:27

    Explore inner classes in Python to structure complex pygame characters, handle gravity, collisions, and sprite updates, and build a basic two-dimensional game with rectangles, colors, and keyboard controls.

  • input output card8:26

    Learn to use pygame for input and output with cards, load card images, manage relative positions, and render text on an 800 by 600 screen.

  • __int__ method1:53

    Explore the __init__ method in Python for game characters, defining a GameCharacter class with name, attributes, and methods to take damage and manage attack power.

  • iterator3:20

    Learn to implement an iterator to update game objects, including enemies and bullets, in the pygame loop, then draw them and manage the FPS for performance.

  • json program8:09

    Learn to use JSON in pygame to load and save game data, tile map data, and player coordinates, parse with Python's JSON module, and handle errors in VS Code.

  • lists6:36

    Learn Python and Pygame with random to spawn balls, store them in a list, set their position, speed, color, and render at 60 fps.

  • Turn Around on the Ledge4:54

    Turn enemies around at screen edges in a platformer by reversing their direction when they hit the ledge, using speed times direction and rectangle collision in Pygame.

  • match10:47

    Build a match-based card game with Python and Pygame, covering loading cards, randomization, flipping, a 4x4 grid, and a game loop with win/lose states and JSON logs.

  • Game math 25:47

    Explore how math works in Pygame with the Vector2 class for position and velocity. Initialize Pygame, set up 800 by 600, center the player, handle input, and draw a circle.

  • operators12:57

    Explore how operators in Python power 2D Pygame game logic, including color handling and collision detection. Implement display setup, events, and basic life bar mechanics.

  • Polymorphism12:46

    Learn polymorphism in Python with Pygame by applying a base game object class, updating and drawing multiple objects through a single interface, and exploring inheritance, design patterns, and event handling.

  • read file csv7:46

    Learn to read csv files in Python for a pygame project, using the csv module to parse data, load tile maps, and render assets with screen.blit.

  • enumerate7:12

    Enumerate over level objects by indexing from zero to the end, loading level data from a text file to map walls and floors to textures and build the tile map.

  • getters and setters5:00

    Learn to implement getters and setters in Python with Pygame. Explore tile map data, mouse coordinate checks, and level width and height calculations from tile size.

Requirements

  • Student need not know how to program but they should have access to the internet to download required resources to start and install compilers and tools needed to develop software.

Description

Python Programming made Interesting for a change in Extreme Pygame Programming. In this course students will learn by doing and following along with the instructor while the instructor creates 5 complete game genres. The video series is broken into smaller individualized sections with review questions for each section of the course. In this complete Python course  series students will gain greater understanding of using Pygame's features to create fun video games. Python has become one of the most popular modern programming languages today. Learn why and have some fun for a change making a Vampire Hunter inspired FPS then move onto creating a multi stage Top Down Shooter where tons of enemies clutter the screen. If speed is more your goal create a few quick racing titles Outrun or Mario-Kart inspired by the early 1990s gaming era. In this fast course students will learn also how to create and draw their own art assets and develop game environments which can be ported to the modern browser or mobile devices. Python supports networking as well as features for creating websites and much much more. Unlike other courses for Python this Course assumes you have already perhaps seen some of what python can do already. Although those features will be mentioned this Intermediate Level series is intended for someone who is seriously considering making Industry level titles. Games like Nuclear Thrown or Torchlight-like games require a great deal of fore planning and sometimes a team of individuals to create. Since Well maybe making your own Vampire Survival game  could inspire you… Why not learn today.

Who this course is for:

  • Beginner to Expert level programmers who would like to challenge themselves and learn a new programming language.