See attached file
SudoMarioBros Assignment 1 CSSE1001/7030 Semester 2, 2019 Version 1.0.0 10 marks Due 23 Aug 19 20:30 Introduction The goal of this assignment is to produce a simplistic 2D platformer game with Python. This assignment will give you an opportunity to utilise the concepts that you have already learnt this semester. You will be asked to write several functions, outlined in this document, to successfully implement the expected game. GettingStarted The archive contains all the necessary files to start this assignment. Some support code has been provided to assist with loading levels of the game. Additionally some map files have been provided (level1.txt, level2.txt, etc). The main assignment file is , which contains the base you will use to implement your assignment. The other provided file is , which contains some code to help you implement your assignment. You are not required to use this file to implement your assignment but it is strongly recommended. Concepts BasicRunningoftheGame a1_files.zip a1.py a1_support.py There are a couple of important concepts to help you understand how to complete the assignment. levels: Levels are stored as text files which represent the playing field or map of the game. Levels are loaded from the text files using the function in the support code. This will return a string representation of the level which is used by your program to play the game. positions: Positions are represented as tuples which store two integers. The first integer in a position tuple is the x coordinate, starting at zero from the left side of the game window. The second integer in a position tuple is the y coordinate, starting at zero from the bottom side of the game window. directions: Directions are represented by characters, and can only have one of the values "r", "l", "u" or "d" (representing right, left, up, and down respectively). For any function which deals with directions, you are not required to handle any inputs which do not have one of these values. tiles: Tiles are characters from a level file. There are 7 different possible tiles. Character Description An air tile, represented by a space, a player can move onto these tiles without consequence. @ A monster tile, a player needs to attack this before moving to this tile, otherwise the player will die. $ A coin tile, when a player moves to this tile their score will increase by one. * A player tile, this is how the player is represented in the game. # A wall tile, a player cannot pass through this tile, if they move onto a wall tile they will rise until there is an airtile available. ^ A checkpoint tile, only relevant for the bonus task, see the checkpoint section. I A goal tile, when a player moves onto this tile they win the game. Implementation To successfully complete this assignment you will need to implement the following functions exactly as they are described. Return the position that would result from moving from given position in the given direction. If the direction "r" is given, increase the x coordinate by 1. If the direction "l" is given, decrease the x coordinate by 1. If the direction "u" is given, increase the y coordinate by 1. If the direction "d" is given, decrease the y coordinate by 1. Return the character representing the tile at the given position in a level string. Hint: refer to in the support file. Determine the new position which results from moving the given position in the given direction, and return the character representing the tile found at this new position. Return a level string exactly the same as the one given, but with the given position replaced by an air tile. Return the updated position that results from moving the character from the given position in the given direction. If the tile at the updated position is a wall tile, adjust the position up until an air tile is found and return that as the position instead. If the tile immediately below the next position is an air tile, adjust the position down until the tile below is a not an air tile and load_level get_position_in_direction(position, direction) get_tile_at_position(level, position) position_to_index get_tile_in_direction(level, position, direction) remove_from_level(level, position) move(level, position, direction) return that as the position instead. It is important that you check whether the next position is a wall tile before checking if the tile below is an air tile. Print the level (i.e. string) with the tile of the given position replaced by the player tile. Check if the position to the left of the player is a monster, if it is then print and return the level with the monster tile removed. Check if the position to the right of the player is a monster, if it is then print and return the level with the monster tile removed. If neither the left side nor the right side of the player contains a monster, then print and return the level unchanged. If the tile at the position is the goal tile then print If the tile at the position is a monster tile then print If the tile at the position is either a coin tile or checkpoint tile, remove the tile from the level. Finally, return a tuple containing the tile character and the level. Handles the main interaction with the user. When the game starts, it should ask the user for a file to load a level from as follows: Once the user enters the name of the level file, it should load that level from the file and print the current score as followed by printing the loaded level with the player at the starting position of x=0, y=1. The program should then repeatedly ask the user After each action is input, it should perform the action and print out the current score and the level. Actions are described in the table below. Character Description ? Print out the string defined in r Move the player to the right, if the player hits a monster or goal, stop the game. If the player hits a coin,increase their score. l Move the player to the left, if the player hits a monster or goal, stop the game. If the player hits a coin,increase their score. a Attack a monster immediately left or right of the player. n Reset to the last checkpoint reached - Bonus Task Only q Stop the game (don't print the level or prompt the user again). Bonus – Checkpoints This task involves adding checkpoints to the game. A checkpoint is a tile in the game which triggers the saving of the current state (level map, player position and player score) when the player moves to that tile. If the player is killed by an enemy then the level should be reset to the last state saved by a checkpoint. Checkpoints should be implemented as apart of your function. The marks associated with this task are additional marks that will increase the total to above 10 marks. You will still be limited to a total of 10 marks for this assignment. The intention of this task is to allow you to demonstrate a good understanding of the print_level(level, position) attack(level, position) Attacking the monster on your left! Attacking the monster on your right! No monsters to attack! tile_status(level, position) Congratulations! You finished the level Hit a monster! main Please enter the name of the level file (e.g. level1.txt): Score: 0 Please enter an action (enter '?' for help): HELP_TEXT a1_support.py main content that will allow for some marks to be lost in other areas while still receiving full marks. Examples Please enter the name of the level file (e.g. level1.txt): level1.txt Score: 0 $ @ #### ### ###### * ####### $ $ ######## I ##################################### Please enter an action (enter '?' for help): r Score: 0 $ @ #### ### ###### * ####### $ $ ######## I ##################################### Please enter an action (enter '?' for help): r Score: 0 $ @ #### ### ###### * ####### $ $ ######## I ##################################### Please enter an action (enter '?' for help): r Score: 0 $ @ #### ### ###### * ####### $ $ ######## I ##################################### Please enter an action (enter '?' for help): r Score: 0 $ @ #### ###