In this lesson, you will use a special tool to change your Pygame game into files that can be played on the internet. This tool will make new files like HTML, JS, and WASM. These files are what web browsers use to show games.
In this lesson, you will use a special tool to change your Pygame game into files that can be played on the internet. This tool will make new files like HTML, JS, and WASM. These files are what web browsers use to show games.
Before you change your game into web files, let's make sure your project is ready.
main.py
) are in the right folder.pygame-web
tool installed on your computer. You will use this tool to change your game.Right now, you should not have index.html
or other web files in your project. This means you are ready to convert your game!
Now, you will use the pygame-web
tool to change your game into web files. This tool will create new files that web browsers can understand.
Open your terminal (or command prompt).
Go to the main folder of your Pygame project.
Type this command and press Enter:
pygame-web export
This command will make new files like index.html
, .js
files, and .wasm
files in your project folder.
You've converted your game! Now, let's check to make sure the new web files are there.
Look in your project folder. You should see these new files:
ā
index.html
ā
Some .js
files (like game.js
)
ā
Some .wasm
files (like game.wasm
)
If you see these files, your game is ready for the web!