Step 8 of 12
Write main.py and run it
Open main.py, in the top folder (not inside the inner bobgame folder), and type
from bobgame.game import Game
if __name__ == "__main__":
Game().run()
This builds a Game from the blueprint and calls run() on it. The if __name__ == "__main__": line just means "only do this when I run this file directly".
Run it in the VS Code terminal
.venv\Scripts\python main.py
On Ubuntu use .venv/bin/python main.py. You can also click the play button in the top right of VS Code while main.py is open.
A dark 800 by 600 window should appear. Nothing is in it yet, but you've made the window and the game loop. Press Escape to close it.
If you get ModuleNotFoundError: No module named 'pygame' then you probably didn't run it with the .venv python. Use the full command above.