Compulsory task 1: One correct card - (15 points) Specifications On shelder oraso easy created a map, but it was still v
Posted: Fri Jul 01, 2022 5:33 am
Compulsory task 1: One correct card - (15 points) Specifications On shelder oraso easy created a map, but it was still very simple. By now you have the tools Glaspectelems obstacle Mare Entityoldaye theme Meana a better map. Enums (should also be in a separate file): The interface Tile: A tile interface is a field of the map. Each tile must implement four functions: getName: Returns the name of the field. getSymbol: Returns the symbol to attract on the map. isLootable: True if the field can be picked up. isCollidable: True if the player collides with the ■ object. The classes Item and Obstacle: The classes Item and Obstacle are to implement the interface Tile. Both have a name and a symbol. Each field has two constructors. The first constructor takes only a name and sets the symbol to the first letter of the name, the second takes a name and a symbol. A field can either be pickable or the player collides with it. If the player collides, the field. cannot be entered.
The class Map: The map is a 2-dimensional array consisting of tile objects. In order to place or take them we need the functions placeMapItem(...) and retrieveItem(...). Write a function checkCoordinates(...), which later checks whether the coordinates of the player are within the map during a movement. Full points are only awarded if this function is always used and there is no code duplicate. Last but not least, the map class should output the map on the command line, as shown in the example below. Tile objects are represented by their symbols, the player by an "A". Implement a printMap() function for this. The abstract class Entity: You need entities. For this, you should first create the abstract class Entity, which defines basic functions that each entity must have.
ZT)-Adobe Acrobat Reader DC (64-bit) terschreiben Fenster Hilfe -7exProgrammiere... x 5 / 6 100% H & D The entities store their position and require get methods and set methods which make the X and Y coordinates of each entity accessible. The Player class: The Player class extends the abstract Entity class. A player has a fixed size in- ventar. The functions of the player are implemented as follows: Each player should be able to pick up items with takeItem(), take items out of the inventory with putItemDown(...) and print the inventory with the full names of the objects on the console with printInventory. takeItem) searches for empty space in inventory, if found, saves passed item putltemDown (...) searches for passed name in the inventory, if found, returns the Tile object The remaining functions work as described for the description of entities. It starts at the coordinates (010). The GameMaster class: To control the player's actions, we write a GameMaster. The size of the playing field is to be passed as a command line argument. Randomly place Tile objects. After setting up the playing field, we now move into the "runtime". In the runtime() function, you are to convert your or our runtime algorithm from sheet 2 into the object-oriented format used here. However, the player does not catch pocket monsters but picks up items. However, you do not have to save the path you have walked. It is sufficient if you output the total number of steps at the end. Q
Sample issue: You have chosen a 10 x 10 map. Study the map and IP eps at the end. choose your path wisely. IR #1 Bonus (not rated): NPC trainer and combat