Class

Map

Map()

The Map class manages the configuration and generation of game maps. Maps are represented as arrays of strings, where each character denotes a different game entity such as walls, enemies, pickups, and the player.
Constructor

# new Map()

Create a new map.

View Source browser/lib/Scene/Map.js, line 10

Classes

Map

Members

array

# ammoPickupPositions

ammoPickupPositions - the ammo pickup item positions

View Source browser/lib/Scene/Map.js, line 57

array

# enemyPositions

enemyPositions - the enemy spawn positions

View Source browser/lib/Scene/Map.js, line 45

array

# healthPickupPositions

healthPickupPositions - the healt pickup item positions

View Source browser/lib/Scene/Map.js, line 63

Object

# playerPosition

playerPosition - the player's spawn position

View Source browser/lib/Scene/Map.js, line 36

array

# staminaPickupPositions

staminaPickupPositions - the stamina pickup item positions

View Source browser/lib/Scene/Map.js, line 69

array

# wallPositions

enemyPositions - the wall placement positions

View Source browser/lib/Scene/Map.js, line 51

Methods

# generate(levelIndex) → {void}

Generate a new map. Generates a new map based on the specified levelIndex. Processes the corresponding level configuration and updates position arrays for entities.
Parameters:
Name Type Default Description
levelIndex number 1 the index of the level configuration

View Source browser/lib/Scene/Map.js, line 82

void

# getAmmoPickupPositions() → {array}

Get the ammo pickup entities' map positions.

View Source browser/lib/Scene/Map.js, line 135

array

# getEnemyPositions() → {array}

Get the enemy entities' map positions.

View Source browser/lib/Scene/Map.js, line 117

array

# getHealthPickupPositions() → {array}

Get the health pickup entities' map positions.

View Source browser/lib/Scene/Map.js, line 144

array

# getPlayerPosition() → {Object}

Get the player entity's map position.

View Source browser/lib/Scene/Map.js, line 108

Object

# getStaminaPickupPositions() → {array}

Get the stamina pickup entities' map positions.

View Source browser/lib/Scene/Map.js, line 153

array

# getWallPositions() → {array}

Get the wall pickup entities' map positions.

View Source browser/lib/Scene/Map.js, line 126

array

# newMapConfiguration() → {void}

Reset all map entity positions. Resets all entity positions to their default values, placing the player at the top-left corner and clearing arrays for enemies, walls, ammo pickups, health pickups, and stamina pickups.

View Source browser/lib/Scene/Map.js, line 31

void