
Explore basic game design with Python, create game sketches that introduce user interfaces and interactivity, culminating in an advanced multi-level game that displays information and increases in difficulty.
Discover Trinket, an in-browser JavaScript Python interpreter you can run and edit without logging in. Create a free account to remix, share, and embed your Python projects.
Discover why the Python turtle module powers beginner games, learn to create custom modules, control turtles with keyboard, and build engaging level-based games with score tracking.
Adopt a conversation-driven approach to learning Python through hands-on turtle game sketches. Engage daily, deepen techniques, and extend sketches to explore new capabilities, while advanced topics are offered later.
Use the trinket working files locally or in the browser by downloading helper.py and main.py, unzipping the bundle, and running python main.py, noting OS quirks of turtle.
Explore turtle screen and key events, linking arrow keys to turtle movement and mouse clicks to screen actions, including drawing circles and changing background colors with random colors.
Explore how click, release, and drag events control turtle behavior in python turtle graphics, including toggling colors, glowing effects, and drag-based positioning.
Build a simple drawing app with a turtle that responds to clicks and drags, cycles colors using a color index and modulo, and fills the screen with the current color.
Create a basic drawing app that fills the screen with Tina's current color via a key, retrieving color from Tina's color list, and extend with circles and width controls.
Learn object oriented programming in python by extending the turtle class to create multiple box turtles with brown color and new behaviors, using initialization and self.
Extend a Python turtle class by adding custom methods, using self to access objects, and make the draw circle method’s size configurable with a default value.
Extend the built-in turtle class to create custom counters that display live counts on a screen, incrementing with each click and using up and down keys to manage counters.
Extend the turtle counter class to create up and down counters with custom coordinates. Link the up and down keys to call show count on each counter, displaying counts instantly.
Extend the built-in turtle class to create a runner and a red chaser in a Python game sketch, where the player controls the black runner and the chaser targets it.
Refactor the turtle game by adding custom reset and track methods to chaser and runner, preserving internal attributes and tracking the designated target.
Finish the turtle chase sketch by making all chasers track the runner with a shared function, reset them, and add a tag counter that increments when the runner is caught.
Python game development: create a tag counter with a custom counter class, display it in upper right, and increment it when the chaser tags the runner in the track method.
Learn to manage game state with a dictionary, track clicks via a 'clicks' key, and switch the active turtle (Tina or Tommy) to control on-screen behavior.
Use a state dictionary to switch the active turtle through clicks. Implement a writer turtle class with become active and on click linking to update state.
Link turtle user controls with four box objects, using a check intersect to detect overlaps and trigger the box flash, then print a win message when all boxes are hit.
Learn how the check_intersect function detects turtle and box proximity using x bounds, y bounds, and radius, and how four boxes' hits trigger the windscreen win.
Display the score and boxes hit as the turtle intersects them. Create a score counter by subclassing the base counter, instantiate it, and track seconds with clock.
Display game state part 2 guides adding a score counter that tracks touched boxes, updates on each hit, and prints final score with time when all four are touched.
Develop an introductory Python turtle game where the player moves a turtle to touch box turtles that flash and hide in shells, while autonomous turtles wrap around the screen.
Implement autonomous turtle movement in a while loop using random.choice and a move method that turns up to 45 degrees and moves 3–20 steps, with mirror image and score updates.
Learn to add random surprises to your turtle game by using random numbers and behavior, awakening and reawakening turtles to increase challenge with a debugging function.
Implement escalating levels in Python game development by varying the number of turtles, their speed and movement, and display level progression and win state.
Demonstrates escalating levels in a Python game, displaying level numbers and live scores as turtle counts rise. Introduces a boom function and debugging ideas to refine level logic.
Learn how screen tracer manages turtle animation to prevent artifacts by skipping frames, and adjust update speed using tracer values to render frames incrementally.
Adjust world coordinates to place internal objects like Tina at 500, 500 in the screen center, but beware non-square worlds distort the screen geometry.
discover two ways to add images to turtle programs: set a background image and set the turtle's shape, using bgpic and image formats with paths on trinket or locally.
Explore Python's private methods and attributes, using double underscores to indicate internal use and restrict outside access, and expose a small public interface with show_count while keeping count private.
Review how we built interactive Python games with input handling, object intersections, and level-based progression, and discover resources for Python 2.7/3 and pygame to keep you coding.
In this Python Game Development for Beginners training course, expert author Elliottt Hauser will teach you how to build your own game sketches using Python's built-in turtle module. This course is designed for the absolute beginner, meaning no Python or game development experience is required.
You will start by learning about simple user interfaces, then jump into learning how to make your own game objects with class inheritance. From there, Elliott will teach you about the game state dictionary, how to check for intersection, and how to display game state. Finally, this video tutorial covers some advanced topics, including adding images to Turtle and private methods and attributes.
Once you have completed this computer based training course, you will be fully capable of creating your own user interfaces and games with the turtle module. Working files are included, allowing you to follow along with the author throughout the lessons.