Class TMap

Unit

Declaration

type TMap = class(TObject)

Description

Class representing the map and all object placed on it.

Hierarchy

Overview

Methods

Public constructor Create(aplayer: TPlayer; astart_room: integer = 0);
Public procedure add_room(aroom: TRoom);
Public function move_player(adir: string): boolean;
Public procedure Free;

Properties

Public property current_room: TRoom read _get_current_room;
Public property current_field: TField read _get_current_field;
Public property current_field_idx: integer read _current_field;
Public property current_room_idx: integer read _current_room;
Public property start_room: integer read _start_room;
Public property player: TPlayer read _player;

Description

Methods

Public constructor Create(aplayer: TPlayer; astart_room: integer = 0);

constructor for a new map

Parameters
aplayer
The player instance (should preferably be the only one/Singleton)
astart_room
The room id in which the player starts.
Returns

A new instance of TMap.

Public procedure add_room(aroom: TRoom);

Procedure to add a new room to the map.

Parameters
aroom
the room that should get added to the map.
Public function move_player(adir: string): boolean;

Function that moves the player on the map.

Parameters
adir
the direction as a string in which the player should walk.
Returns

Indicates if the player walked into another room.

Public procedure Free;

procedure to clean up memory after use.

Properties

Public property current_room: TRoom read _get_current_room;

Read-only Object-property representing the room the player currently is in.

Public property current_field: TField read _get_current_field;

Read-only Object-property representing the field the player currently is on.

Public property current_field_idx: integer read _current_field;

Read-only Integer-property representing the 1d-index of the field the player is currently on.

Public property current_room_idx: integer read _current_room;
 
Public property start_room: integer read _start_room;
 
Public property player: TPlayer read _player;

Read-only Object-property that represents the player on the map.


Generated by PasDoc 0.16.0.