Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Projects in Python: Get started with Python game development
Rating: 3.8 out of 5(32 ratings)
415 students

Projects in Python: Get started with Python game development

Learn the basics of Python game development while you create your very own Space Invaders clone using Python 3.
Created byTony Staunton
Last updated 11/2018
English
English [Auto],

What you'll learn

  • Create a fully featured and working game in Python which you can use for you portfolio.
  • Take your new knowledge and create more advanced games.
  • Advance their current knowledge of Python to take on larger more complicated projects.

Course content

3 sections54 lectures4h 33m total length
  • Installing Homebrew and pygame3:43

    Install pygame on macOS using Homebrew and terminal commands; verify by importing pygame, install dependencies like SDL libraries, then install pygame via pip and run a test import.

  • Our game code structure5:46

    Explore the basic structure of a Python game using pi game, including initializing the display, setting the window to 1200 by 800, and an event loop.

  • How to change our games background colour2:14

    Define a background color as BG color before the main loop and use screen.fill with this color to redraw the screen, changing from black to sky blue.

  • Creating a settings class for our game5:09

    Create a settings module with a settings class to store game configurations such as screen width, screen height, and background color, then import and apply it in the game file.

  • Creating the ship class6:33

    we create a ship class to load and position the ship image at the bottom center of the screen using pygame's image load and rect attributes.

  • Refactoring part 13:50

    Refactor your Python game by moving event handling into a new game functions module and a check events function, isolating the event loop and aliasing the module for cleaner code.

  • Refactoring Part 23:03

    Refactor the update screen logic in Python game development by moving code into a dedicated game_functions module, explaining indentation, imports, and cleaner run_game workflow.

  • Moving our ship to the right4:10

    Learn to move the ship right in pygame by handling key down events and checking for the right arrow key to update the ship's x coordinate.

  • Constant movement5:44

    Learn to implement continuous movement by detecting key down and key up events, using the ship's moving_right flag and an update method to move while the right arrow is held.

  • Moving our ship to the left2:39

    Move the ship left using a movement flag, update center x by one on left key events in pygame, and stop the ship when the left key event occurs.

  • Making our spaceship go faster4:30

    Upgrade the ship's speed using a ship_speed setting (initially 1.5), move by that speed via the update method, and pass the settings to the ship in the main program.

  • Stopping our spaceship at the screen's edge3:13

    Learn to prevent spaceship wrap-around by implementing edge-boundary checks that stop the ship at the screen's left and right edges using the ship's rect positions.

  • Creating our bullet settings1:36

    Add bullet settings to the settings program to enable shooting bullets via the spacebar, defining bullet speed and dimensions, and prepare for a new class in the next lecture.

  • Creating our bullet class9:31

    Create a bullet class that inherits from sprite, positions bullets at the ship, and updates and draws them moving upward from the ship with configurable color and speed.

  • Creating our bullets group2:45

    Create a bullets group to store live bullets, using pygame sprite group to update and draw bullets each loop, with spacebar firing and the group's update handling bullet positions.

  • Refactoring check events6:01

    Refactor the game by adding check_key_down_events and check_key_up_events to handle pygame key down and key up events, updating ship movement and stopping on key release.

  • Firing bullets5:58

    press the space bar to fire bullets by creating bullet instances and drawing them each frame behind the ship and aliens.

  • Deleting bullets4:54

    Remove bullets that go off screen to prevent memory bloat. Iterate over a copy of the bullets group and delete off screen bullets.

  • Updating our delete bullets function3:32

    Move update bullets logic to the game functions module, creating update_bullets to advance bullets and remove off-screen ones. Integrate with the main program and speed up bullets for a demo.

Requirements

  • Students should have a basic understanding of the Python language.
  • Have Python 3 installed.

Description

This course has over 50 lectures, is 4+ hours long and is only $25

Are you ready to save the earth from invaders from the planet python? If so, then you can take your Python skills from basic to advanced by creating a fully featured and professional Space Invaders clone called Invaders from Python.

This course is the follow-up to my hugely successful Python 3: A Beginners Quick Start Guide to Python and will take you the student from knowing the basics of the Python programming language and walk you through creating your very own Python game.

Along your journey you will learn:

  • The basic structure for a game written in Pygame
  • Python modules to manage graphics and animation
  • How to install Homebrew and Pygame
  • How to add images to your games
  • Make game objects move on screen
  • Refactoring and bug checking
  • How to respond to game events such as mouse and key presses
  • How to interact between different elements of your game
  • What are and use nested loops
  • How to create different levels of your game to make it more challenging
  • Add a score board and players high scores
  • And more...


This course has over 50 lectures and is 4+ hours long. You will start with a blank Python file and when you are finished you will have the skills to create and develop many more games and programmes as the skills you learn here are not just for game development.

Projects in Python is intended for those who already have a working knowledge of Python programming or general programming, and who want to apply their skills to games development. However, beginners may still be able to follow the course too.

The main learning drive in this course is in helping you to create your very own Space Invaders clone called Invaders from Python. Each lecture is like a level within a video game, as you move through the course you will be introduced to more and more advanced topics.

The skills you picked up along the way will give you a solid groundwork for creating bigger, more complex, and more versatile games that can be run on any platform or any operating system.

This course is fun and challenging and I am always on hand to answer questions and help out. 

Best of luck!


Who this course is for:

  • Students who have completed a beginners Python course and are now looking to explore more advanced topics.
  • Students who are ready to jump in to Python game development and start learning.
  • Students who are coming from other programming languages and who don't want to start at the very beginning again.