Class: RandomMap

RandomMap()

new RandomMap()

Source:

Members

IDToName

Source:

IDToName[undefined]

Source:

entities

Source:

entityCount

Source:

height

Source:

height[undefined]

Source:

height[undefined][undefined]

Source:

height[undefined][undefined]

Source:

logger

Source:

nameToID

Source:

nameToID[undefined]

Source:

size

Source:

terrainEntities

Source:

terrainEntities[undefined]

Source:

terrainEntities[undefined][undefined]

Source:

terrainEntities[undefined][undefined]

Source:

terrainEntities[undefined][undefined]

Source:

texture

Source:

texture[undefined]

Source:

texture[undefined][undefined]

Source:

texture[undefined][undefined]

Source:

(inner) i

Source:

(inner) i

Source:

(inner) j

Source:

(inner) j

Source:

(inner) mapSize

Source:

(inner) x

Source:

(inner) z

Source:

Methods

LoadHeightmapImage()

Loads PMP terrain file that contains elevation grid and terrain textures created in atlas. Scales the map (including height) proportionally with the mapsize. Notice that the image heights can only be between 0 and 255, but the resulting sizes can exceed that range due to the cubic interpolation.
Source:

LoadMapTerrain()

Loads an imagefile and uses it as the heightmap for the current map. Scales the map (including height) proportionally with the mapsize.
Source:

MakeExportable()

Source:

cornerHeight()

Source:

createTileClass()

Source:

deleteTerrainEntity()

Source:

exportEntityList()

Retrieve an array of all Entities placed on the map.
Source:

exportHeightData()

Convert the elevation grid to a one-dimensional array.
Source:

exportTerrainTextures()

Assemble terrain textures in a one-dimensional array.
Source:

getAdjacentPoints()

Source:

getArea()

Source:

getAverageHeight()

Returns the average height of adjacent tiles, helpful for smoothing.
Source:

getBounds()

Returns a human-readable reference to the smallest and greatest coordinates of the map.
Source:

getCenter()

Returns the center tile coordinates of the map.
Source:

getEntityID()

Returns the next unused entityID.
Source:

getExactHeight()

Retrieve interpolated height for arbitrary coordinates within the heightmap grid.
Source:

getHeight()

Source:

getSize()

Source:

getSlope()

Returns the steepness of the given location, defined as the average height difference of the adjacent tiles.
Source:

getTerrainEntity()

Returns the Entity that was painted by a Terrain class on the given tile or undefined otherwise.
Source:

getTexture()

Returns the name of the texture of the given tile.
Source:

getTextureID()

Returns the ID of a texture name. Creates a new ID if there isn't one assigned yet.
Source:

inMapBounds()

Determines whether the given coordinates are within the tile grid, passable or not. Should be used to restrict texture painting.
Source:

isCircularMap()

Source:

log()

Prints a timed log entry to stdout and the logfile.
Source:

placeEntityAnywhere()

Adds the given Entity to the map at the location it defines, even if at the impassable map border.
Source:

placeEntityPassable()

Adds the given Entity to the map at the location it defines, if that area is not at the impassable map border.
Source:

randomCoordinate(passableOnly)

Returns a random point on the map.
Parameters:
Name Type Description
passableOnly Should be true for entity placement and false for terrain or elevation operations.
Source:

setHeight()

Source:

setTerrainEntity()

Places the Entity on the given tile and allows to later replace it if the terrain was painted over.
Source:

setTexture()

Paints the given texture on the given tile.
Source:

validHeight()

Determines whether the given coordinates are within the heightmap grid. Should be used to restrict elevation changes.
Source:

validTile()

Determines whether the given coordinates are within the given distance of the map area. Should be used to restrict actor placement. Entity placement should be checked against validTilePassable to exclude the map border. Terrain texture changes should be tested against inMapBounds.
Source:

validTilePassable()

Determines whether the given coordinates are within the given distance of the passable map area. Should be used to restrict entity placement and path creation.
Source: