In this project you've got a story, to help the student's solving their bugs. You find the Story in the root dir called Story.pdf.
According to the story you have some level's to complete. You have #TODO in the code, which explains where you have to add your code solution.
After you solved a level, you have to update the level nr in the game.py file. It's also marked with a TODO, to find it easy.
To start the game, see Run Game.
Suggested to use an IDE like VSCode, IntelliJ for this project and a plugin which hilights #TODO in the code.
- python 3.10 or higher
- pygame v2.5.2 Docs
Here is a quick introduction, how to setup a virtual python environment and install the required dependencies. After following this instructions, your ready to work on the project.
To create a virtual environment in Python, you can use the venv module. Here's how you can do it:
-
Open a terminal or command prompt.
-
Navigate to the directory where you want to create the virtual environment.
-
Run the following command to create a virtual environment named "venv":
python -m venv venv
This will create a new directory named "venv" in your current directory, which will contain the virtual environment.
-
Activate the virtual environment. The steps to activate the virtual environment depend on your operating system:
-
Windows:
venv\Scripts\activate
-
Mac/Linux:
source venv/bin/activate
Once activated, you will see the name of the virtual environment in your command prompt or terminal.
-
-
You can now install packages and run Python scripts within the virtual environment without affecting your system-wide Python installation.
Dependencies for running the game.
pip install -r requirements.txtfor development
pip install -r requirements-dev.txtTo run the game, you can open the game.py file and press the run button on the top right (VSCode). It's also possible to run it in debug mode.
Or run it directly in the terminal, with the activated env and enter the following command.
python bugsy/game.py
To deactivate the virtual environment and return to your system's default Python environment, simply run the following command:
If you encounter an "Execution Policy" error on Windows when trying to activate the virtual environment, you can fix it by following these steps:
-
Open a PowerShell window as an administrator.
-
Run the following command to set the execution policy to "RemoteSigned":
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserThis will allow the execution of scripts on your system.
-
Confirm the change by typing "A" and pressing Enter.
-
You should now be able to activate the virtual environment without encountering the "Execution Policy" error.
Remember to set the execution policy back to its original value after you are done with the virtual environment by running the following command:
Set-ExecutionPolicy Default -Scope CurrentUser