Would you like to build a 2D adventure game with Python and PyGame? This code is from a free video series on YouTube which you can watch to build a game like this step-by-step!
The playlist on YouTube for each step can be found here Pygame - Adventure Game.
- Open a terminal at the project location. In VSCode, go to the top where it says Terminal, and click New Terminal. If you don't see terminal, you may see three dots near the top left, click those and see if Terminal is under those.
- Create a virtual environment. Run
python3 -m venv venv
. If you get an error, trypython -m venv venv
. If this still does not work, ensure Python is installed on your system. - Activate the virtual environment. On MacOS, Linux and Unix, run
source venv/bin/activate
. On Windows, runvenv/Scripts/activate
. - Install Pygame by typing
pip install pygame
. - Run the game by typing
python3 src/main.py
. If this doesn't succeed, trypython src/main.py
.
Item | Description |
---|---|
content | Asset files (images, map data, etc.) is here |
docs | Documentation for our game (coming soon) |
src | Python code for the game is here. |
You are absolutely allowed to use the code and assets from this game in your own games, even commercially, and even for closed source games you make, as long as you agree to the license included in this project.
My goal is to help you in making your own games, and I hope this work can be of value to you.