Task 1 – Basic GUI
1.1 – Working Game
For this task, you will need to write code in , which will start the game when the file is run. This will require you to write
the function to launch the GUI.
You should modify so that the window title is something appropriate (e.g. “Mario”)
Once the game runs, you will need to implement keyboard bindings. You should find an appropriate location in the class to
make calls for each of the keyboard presses to the appropriate method. The binds should behave as follows:
W, UP, SPACE Makes the player jump (Hint: see ).
A, LEFT Moves the player to the left (Hint: see ).
S, DOWN Makes the player duck (Hint: see ).
D, RIGHT Moves the player to the right (Hint: see ).
1.2 – File Menu and Dialogs
Implement a menu for the game which has a top level “File” menu. Within the “File” menu, you will need the following buttons:
Prompts the user with a popup text input dialog. When the player inputs a level filename, load that level
replacing the currently loaded level.
Level Reset all player progress (e.g. health, score, etc) in the current level.
Exit Exits the game.
When a player runs out of health, you should show a dialogue asking whether they want to restart the current level or exit the
Note: On Mac OS X, the file menu should appear in the global menu bar (top of the screen).
1.3 – Status Display
Implement a custom tkinter widget (i.e. a class which inherits from ) which displays the score and health of the
player at the bottom of the window.
The player’s score should be shown as a single number. The health of the player should be displayed as a ‘health bar’ (similar
to the image below). The health bar should be coloured as follows:
When the player has greater than or equal to 50% of their maximum health, it should be coloured green.
When the player has between 25% and 50% of their maximum health, it should be coloured orange.
When the player has less than or equal to 25% of their maximum health, it should be coloured red.
This widget needs to be updated when the score and health of the player updates during gameplay.