TextWorld is a simple 2D action game that is played in the terminal/console. The player collects items while avoiding a monster. The game is written in Python3. I use it as a lab for my students to explore how to create a simple game.
The students are given a minimal working sample of the game. In this sample, the player can only move left and right. The students then need to add in code so it turns into a fully functioning game.
In order for the game to be fully functioning, the students need to do the following tasks:
- Make the player move up and down
- Make the player stay on the screen
- Make a wall around the playing area
- Create an item for the player to collect
- Add a score
- Add a monster
For the students that finish the lab early, I encourage the students to add things to make the game more interesting. Some extra things students have added in the past include powerups like extra health, teleporters, and wrap around (ex. going off the screen on the left side makes the player appear on the right side)
Before students can start this lab, they should know selection statements and loops.
My students really enjoyed doing this lab and had a lot of fun. I hope your students enjoy it too. Let me know how the lab worked for you in the comments below.
I have included the lab description as well as the source code for the minimum work sample.
The source code is released under the MIT License. The lab is released under the Creative Commons Attribution ShareAlike 4.0 International License.
If you like my work, a small donation or feedback will be much appreciated.