Mario Assignment 3 CSSE1001/7030 Semester 2, 2019 Version 1.1.0 20 marks Due Friday 18th October, 2019, 20:30 Introduction The goal of this assignment is to extend the existing support code of a mario...

Python assignment of making Mario game due on coming Friday. Please refer to the attached a3_spec file (PDF) for more details regarding the assignment


Mario Assignment 3 CSSE1001/7030 Semester 2, 2019 Version 1.1.0 20 marks Due Friday 18th October, 2019, 20:30 Introduction The goal of this assignment is to extend the existing support code of a mario style 2D-platformer written in Python using tkinter. To be successful in completing this assignment you will have to use the concepts and skills that you have learnt. Specifically, you will need to have a good understanding of GUI programming, inter-class interactions, extending classes and file IO. This document outlines the tasks that you will need to implement for this assignment. Getting Started The archive file contains all the necessary files to start this assignment. A significant amount of support code has been provided to allow for the basic working game functionality to be implemented relatively easily. The main assignment file is , which contains an incomplete implementation of , the top-level GUI application class. You should add code to and modify to implement the necessary functionality. All features and code you write should be placed inside , or . You are not permitted to modify any files inside the game directory. Your assignment must be able to be launched by running Basic Running of the Game a3_files.zip app.py MarioApp app.py MarioApp app.py level.py player.py app.py Because this assignment deals with multiple files, while not required, you may wish to investigate a more sophisticated IDE. One option is PyCharm, which is free for students. Pymunk Library Physics is implemented in the game using the Pymunk library. It may be useful in completing the assignment to have an understanding of some of the components of the Pymunk library as you may need to refer to these libraries. You will need to install this library in order to implement your tasks for this assignment. Pymunk can be installed by running the included . Overview The assignment is broken down into three main tasks: 1. The first task involves modifying the app.py file to implement basic launching of the game and some additional functionality 2. The second task involves extending the game mechanics to add more functionality to the game 3. The third task is for you to independently design and implement a sufficiently complex feature of your choosing For postgraduates: There is an additional task for you to complete. You will need to appropriately implement animations using sprite sheets in the folder. 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: Key Action 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: Button Purpose Load Level Prompts the user with a popup text input dialog. When the player inputs a level filename, load that level replacing the currently loaded level. setup.py spritesheets app.py main MarioApp MarioApp bind MarioApp._jump MarioApp._move MarioApp._duck MarioApp._move https://www.jetbrains.com/pycharm/ https://www.jetbrains.com/student/ http://www.pymunk.org/en/latest/ Button Purpose Reset 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 game. 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. 1.4 - Bounce Block Implement a type of block which will propel the player into the air when they walk over or jump on top of the block. The velocity with which you propel the player should be sensible but noticeable. Hint: You should implement a bounce block by making a new class which extends . You may (and should) utilise the image files found in The bounce block is represented by the character, in level files. 1.5 - Mushroom Mob Implement a new type of mob which has the following properties: tk.Frame Animated Health Bar Example Block bounce_block a3_files.zip b The mob should move at a reasonably slow rate When the mob collides with a block, player, or other mob it should reverse its direction (HINT: ) When the mob collides with the side of a player, the player should lose 1 health point and be slightly repelled away from the mob When a player lands on top of the mob, the player should bounce off the top of the mob and the mob should be destroyed You may find it useful to look at the existing mob classes and collision handling methods before commencing this task. You may (and should) utilise the image files found in The mushroom mob is represented by the character, in level files. Task 2 - Extending the Game 2.1 - Star Item Implement a type of item that makes the player invincible for 10 seconds (that is, they should not be able to take any damage during this time). Any mobs that the player collides with during this time should be immediately destroyed. During the time the player is invincible, the player's health bar should be coloured yellow. You should utilise the image files found in The star is represented by the character, in level files. 2.2 - Goals Implement a new type of block that acts as a goal and allows changing between levels. The block should be constructed with an id and the name of the next level file. Your must include at least the following two types of goals: Type Sprite Purpose Flagpole When a player collides with this, immediately take the player to the next level. If the player lands ontop of the flag pole, their health should be increased. Tunnel By default this should act as a normal block. However, if the player presses the down key whilestanding on top of this block, the player should be taken to another level. A player's current state (coins, health, etc) should not change when the level changes, apart from their position. You may find the constant defined in useful in determining the size of the various goal types. You may also find the and image files in useful. The flags and tunnels are represented by the characters, and respectively in level files. The levels loaded by the flag and tunnel may be hardcoded until the next task is completed 2.3 - Loading Configuration Implement the ability to load a configuration file for a game of mario. When the game is launched the user should be prompted to enter the file path for a configuration file. The configuration file will be in a similar format to the example given below. Mob.set_tempo mushroom a3_files.zip @ star a3_files.zip * GOAL_SIZES app.py flag tunnel a3_files.zip I = At the minimum, a configuration file will include a tag, a tag and a tag for the level specified as start in A tag should have a property which will set the gravity of a world when it is constructed. It should also contain a property which will be the filepath of the first level to load. A tag should have the following properties: character: This can be either mario or luigi and will change the image displayed in game. x: This is the starting x co-ordinate of the player. y: This is the starting y co-ordinate of the player. mass: This is the weight of the player set when adding the player to the world. health: This is the maximum amount of health a player will have. max_velocity: This is the maximum x velocity that a player can reach when moving. Each of the levels should have it's own tag, e.g. where level is the file path of that level. A level tag should have a property which is the filename of the level to load when the player reaches a flag goal block. If the next level is END then it should prompt the user that the game is over and close the game window. A level tag may also have a property which is the filename of the level to load when the player enters a tunnel block. If the configuration file is invalid, or missing and cannot be parsed, you should alert the user via a error message box and then exit the game. 2.4 - Switches Implement a new type of block that acts like a switch. When a player lands on-top of a switch, all bricks within a close radius of the switch should disappear. A player should not be able to trigger a switch by walking into the side of it (the player should stop moving as if it were any other block). ==World== gravity : 400 start : level1.txt ==Player== character : luigi x : 30 y : 30 mass : 100 health : 4 max_velocity : 100 ==level1.txt== tunnel : bonus.txt goal : level2.txt ==bonus.txt== goal : level1.txt ==level2.txt== tunnel : small_room.txt goal : level3.txt ==small_room.txt== goal : level2.txt ==level3.txt== goal : END ==World== ==Player== ==World== ==World== gravity start ==Player== ==level== goal tunnel tkinter When a switch is pressed
Oct 12, 2021CSSE1001University of Queensland
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here