Welcome to Schulich Ignite Flare! This is our advanced sessions meant for people who are already familiar with the basics (variables, if/else, loops, lists, functions) and interested in learning more. If you're looking for our beginner workshops, take a look here.
Sessions will be using Python with pygame. Our sessions will be using Visual Studio Code (VS Code) as our text editor, but feel free to use any text editor you are comfortable with.
Check out our Session 0 slides for instructions on how to install everything you'll need for our sessions.
We will be using our main.py file as a template for all the projects in Ignite Flare. Make sure you save this file and keep it in a safe spot, as we will be copying it and using it a few times. This holds some pre-written code that is standard for any project using pygame. You won't need to understand how it works, but we encourage you to try your best to learn how it works anyway! You must have pygame installed first to use this file. See Session 0 for instructions.
Unfortunately, GitHub does not offer a simple way to download this file. Instead you must save the contents yourself, by doing the following:
- Click on this file: main_COPY_AND_RENAME.py. Hint: Right click and choose "Open in new tab" so you can keep reading these instructions!
- Right-click and choose "Save as". Save the file somewhere safe and easy to remember.
When you start a new project, do the following:
- Create a new folder and give it a name (like
example
). - Copy the file main_COPY_AND_RENAME.py and paste it inside the
example
you created. - Rename your copied version of
main_COPY_AND_RENAME.py
tomain.py
- Open your text editor. Any text editor works, but the following instructions are written for VS Code.
- In VS Code, select
File
->Open Folder
. - Select the
example
folder you created.
- In VS Code, select
- Run the code. You should only see a blank, black screen.
- In VS Code, you can press the green Play button.
- Alternatively, you can use a terminal or command line:
- Windows: Type
py -3 main.py
- Mac: Type
python main.py
- Windows: Type
- Start coding! Feel free to add to or edit any code you see inside
main.py
.
Note: If you search online for other pygame tutorials, you may find slight variations on the main.py
file. They all roughly do the same thing. If you want to learn more in detail, you can check out the official pygame docs.