Class: Game_Map

Game_Map

new Game_Map()

The game object class for a map. It contains scrolling and passage determination functions.

Methods

adjustX(x)number

Get the adjusted x value
NameTypeDescription
xnumberThe x to adjust
Returns:
TypeDescription
numberThe adjusted x value

adjustY(y)number

Get the adjusted y value
NameTypeDescription
ynumberThe y to adjust
Returns:
TypeDescription
numberThe adjusted y value
Get the airship vehicle
Returns:
TypeDescription
Game_VehicleThe airship object

allTiles(x, y)Array

Get the tiles at the given coordinates
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
Returns:
TypeDescription
ArrayThe tiles at the coordinates

autoplay()

Autoplays map audio

autorunCommonEvents()Array

Get autorun common events
Returns:
TypeDescription
ArrayArray of autorunning common events

autotileType(x, y, z)number

Get the autotile type at the given coordinates
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
znumberThe z index of the tile
Returns:
TypeDescription
numberThe autotile type

battleback1Name()string

Get the battleback 1 image file name
Returns:
TypeDescription
stringThe battleback 1 name

battleback2Name()string

Get the battleback 2 image file name
Returns:
TypeDescription
stringThe battleback 2 name
Get the boat vehicle
Returns:
TypeDescription
Game_VehicleThe boat object

bushDepth()number

Get the bush depth
Since:
  • Version 1.5.0
Returns:
TypeDescription
numberThe bush depth

canvasToMapX(x)number

Get map x from canvas x
NameTypeDescription
xnumberThe x value to convert
Returns:
TypeDescription
numberThe map x

canvasToMapY(y)number

Get map y from canvas y
NameTypeDescription
ynumberThe y value to convert
Returns:
TypeDescription
numberThe map y

changeBattleback(battleback1Name, battleback2Name)

Changes the battleback images
NameTypeDescription
battleback1NamestringThe filename of the battle back 1 image
battleback2NamestringThe filename of the battle back 2 image

changeParallax(name, loopX, loopY, sx, sy)

Changes the parallax image
NameTypeDescription
namestringThe filename of the parallax image
loopXbooleanIf the parallax loops horizontally
loopYbooleanIf the parallax loops vertically
sxnumberThe horziontal scroll of the parallax
synumberThe vertical scroll of the parallax

changeTileset(tilesetId)

Changes the tileset by id
NameTypeDescription
tilesetIdnumberThe new tileset id

checkLayeredTilesFlags(x, y, bit)boolean

Check the layered tile flags
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
bitnumberThe bit to perform bitwise AND operation on with the tile
Returns:
TypeDescription
booleanTrue if a layered tile flag exists

checkPassage(x, y, bit)boolean

Check the passage of the tile at the given coordinates
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
bitnumberThe bit to perform bitwise AND operation on with the tile
Returns:
TypeDescription
booleanTrue if passage allowed

createVehicles()

Creates the vehicles

data()Array

Get the map data
Returns:
TypeDescription
ArrayThe map data

deltaX(x1, x2)number

Get the delta between two x values
NameTypeDescription
x1numberThe first x value
x2numberThe second x value
Returns:
TypeDescription
numberThe delta between the x values

deltaY(y1, y2)number

Get the delta between two y values
NameTypeDescription
y1numberThe first y value
y2numberThe second y value
Returns:
TypeDescription
numberThe delta between the y values

disableNameDisplay()

Disables name display

displayName()string

Get the map display name
Returns:
TypeDescription
stringThe display name

displayX()number

Get the display x
Returns:
TypeDescription
numberThe display x

displayY()number

Get the display y
Returns:
TypeDescription
numberThe display y

distance(x1, y1, x2, y2)number

Get the distance between two sets of x/y coordinates
NameTypeDescription
x1numberThe first x value
y1numberThe first y value
x2numberThe second x value
y2numberThe second y value
Returns:
TypeDescription
numberThe distance

doScroll(direction, distance)

Perform the scroll
NameTypeDescription
directionnumberThe direction to scroll
distancenumberThe distance to scroll

enableNameDisplay()

Enables name display

encounterList()Array

Get the map encounter list
Returns:
TypeDescription
ArrayThe encounter list

encounterStep()number

Get the map encounter step
Returns:
TypeDescription
numberThe encounter step

eraseEvent(eventId)

Erase an event by id
NameTypeDescription
eventIdnumberThe id of the event to erase
Get an event by id
NameTypeDescription
eventIdnumberThe id of the event to get
Returns:
TypeDescription
Game_EventThe event object

eventIdXy(x, y)number

Get the event id at the given coordinates
NameTypeDescription
xnumberThe x coordinate to check for events
ynumberThe y coordinate to check for events
Returns:
TypeDescription
numberThe event id
Get the events
Returns:
TypeDescription
Array.<Game_Event>The array of map events

eventsXy(x, y)Array.<Game_Event>

Get events at the given coordinates
NameTypeDescription
xnumberThe x coordinate to check for events
ynumberThe y coordinate to check for events
Returns:
TypeDescription
Array.<Game_Event>The events at the given coordinates

eventsXyNt(x, y)Array.<Game_Event>

Get no-through events at the given coordinates
NameTypeDescription
xnumberThe x coordinate to check for events
ynumberThe y coordinate to check for events
Returns:
TypeDescription
Array.<Game_Event>The NT events at the given coordinates

height()number

Get the map height
Returns:
TypeDescription
numberThe height

initialize()

Initialize the map class

isAirshipLandOk(x, y)boolean

Check if the airship can land at the given coordinates
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
Returns:
TypeDescription
booleanTrue if landing is ok

isAnyEventStarting()boolean

Check if any events are starting
Returns:
TypeDescription
booleanTrue if any event is starting

isBoatPassable(x, y)boolean

Check if the map is passable for the boat
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
Returns:
TypeDescription
booleanTrue if passable

isBush(x, y)boolean

Check if the tile is a bush
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
booleanTrue if the tile is a bush

isCounter(x, y)boolean

Check if the tile is a counter
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
booleanTrue if the tile is a counter

isDamageFloor(x, y)boolean

Check if the tile is a damage floor
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
booleanTrue if the tile is a damage floor

isDashDisabled()boolean

Check if dashing is disabled
Returns:
TypeDescription
booleanTrue if dashing disabled

isEventRunning()boolean

Check if events are running
Returns:
TypeDescription
booleanTrue if event is running

isLadder(x, y)boolean

Check if the tile is a ladder
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
booleanTrue if the tile is a ladder

isLoopHorizontal()boolean

Check if the map loops horizontally
Returns:
TypeDescription
booleanTrue if the map loops horizontally

isLoopVertical()boolean

Check if the map loops vertically
Returns:
TypeDescription
booleanTrue if the map loops vertically

isNameDisplayEnabled()boolean

Check if the map has an enabled display name
Returns:
TypeDescription
booleanTrue if name display is enabled

isOverworld()boolean

Check if the map is an overworld type
Returns:
TypeDescription
booleanTrue if overworld type

isPassable(x, y, d)boolean

Check if the map is passable
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
dnumberThe direction to check
Returns:
TypeDescription
booleanTrue if passable

isScrolling()boolean

Check if the map is scrolling
Returns:
TypeDescription
booleanTrue if scrolling

isShipPassable(x, y)boolean

Check if the map is passable for the ship
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
Returns:
TypeDescription
booleanTrue if passable

isValid(x, y)boolean

Check if the x/y coordinates given are valid
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
booleanTrue if the coordinates are within the map bounds

layeredTiles(x, y)Array

Get the layered tiles at the given coordinates
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate
Returns:
TypeDescription
ArrayThe tiles at the coordinates

mapId()number

Get the map id
Returns:
TypeDescription
numberThe map id

parallaxName()string

Get the parallax image file name
Returns:
TypeDescription
stringThe parallax name

parallaxOx()number

Get the parallax origin x
Returns:
TypeDescription
numberThe parallax origin x

parallaxOy()number

Get the parallax origin y
Returns:
TypeDescription
numberThe parallax origin y

parallelCommonEvents()Array

Get parallel common events
Returns:
TypeDescription
ArrayArray of parallel common events

refereshVehicles()

Refreshes the vehicles
Refresh the map

refreshIfNeeded()

Refresh the map only if needed

refreshTileEvents()

Refresh tile events

regionId(x, y)number

Get the region id of a tile
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
numberThe region id of the tile

requestRefresh()

Request a map refresh

roundX(x)number

Get the rounded x value
NameTypeDescription
xnumberThe x to round
Returns:
TypeDescription
numberThe rounded x value

roundXWithDirection(x, d)number

Get the rounded x value with direction
NameTypeDescription
xnumberThe original x value
dnumberThe direction
Returns:
TypeDescription
numberThe x value after direction accounted for

roundY(y)number

Get the rounded y value
NameTypeDescription
ynumberThe y to round
Returns:
TypeDescription
numberThe rounded y value

roundYWithDirection(y, d)number

Get the rounded y value with direction
NameTypeDescription
ynumberThe original y value
dnumberThe direction
Returns:
TypeDescription
numberThe y value after direction accounted for

screenTileX()number

Get the screen tile x
Returns:
TypeDescription
numberThe screen tile x

screenTileY()number

Get the screen tile y
Returns:
TypeDescription
numberThe screen tile y

scrollDistance()number

Get the distance to scroll
Returns:
TypeDescription
numberThe distance to scroll

scrollDown(distance)

Scrolls the map down
NameTypeDescription
distancenumberThe distance to scroll

scrollLeft(distance)

Scrolls the map left
NameTypeDescription
distancenumberThe distance to scroll

scrollRight(distance)

Scrolls the map right
NameTypeDescription
distancenumberThe distance to scroll

scrollUp(distance)

Scrolls the map up
NameTypeDescription
distancenumberThe distance to scroll

setDisplayPos(x, y)

Set up the display position
NameTypeDescription
xnumberThe x coordinate
ynumberThe y coordinate

setup(mapId)

Sets up the map for the given map id
NameTypeDescription
mapIdnumberThe map id to setup
Throws:
Error if map data object is not available

setupAutorunCommonEvent()boolean

Sets up an autorun common event
Returns:
TypeDescription
booleanTrue if event set up

setupBattleback()

Set up the map battlebacks

setupEvents()

Set up events on the map

setupParallax()

Set up the map parallax

setupScroll()

Set up the map scroll

setupStartingEvent()boolean

Sets up a starting event
Returns:
TypeDescription
booleanTrue if event set up

setupStartingMapEvent()boolean

Sets up a starting map event
Returns:
TypeDescription
booleanTrue if event set up

setupTestEvent()boolean

Sets up a test event
Returns:
TypeDescription
booleanTrue if event set up
Get the ship vehicle
Returns:
TypeDescription
Game_VehicleThe ship object

startScroll(direction, distance, speed)

Start a map scroll
NameTypeDescription
directionnumberThe direction of the scroll
distancenumberThe distance of the scroll
speednumberThe speed of the scroll

terrainTag(x, y)number

Get the terrain tag of a tile
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
Returns:
TypeDescription
numberThe terrain tag of the tile

tileEventsXy(x, y)Array.<Game_Event>

Get tile events at the given coordinates
NameTypeDescription
xnumberThe x coordinate to check for events
ynumberThe y coordinate to check for events
Returns:
TypeDescription
Array.<Game_Event>The tile events at the given coordinates

tileHeight()number

Get the height of a map tile in pixels
Returns:
TypeDescription
numberThe height of one tile

tileId(x, y, z)number

Get the tile id by coordinate
NameTypeDescription
xnumberThe x coordinate to check
ynumberThe y coordinate to check
znumberThe z index of the tile
Returns:
TypeDescription
numberThe tile id

tileWidth()number

Get the width of a map tile in pixels
Returns:
TypeDescription
numberThe width of one tile

tileset()Object

Get the tileset object
Returns:
TypeDescription
ObjectThe tileset object

tilesetFlags()Array

Get the tileset flags
Returns:
TypeDescription
ArrayThe tileset's flags

tilesetId()number

Get the tileset id
Returns:
TypeDescription
numberThe tileset id

unlockEvent(eventId)

Unlock an event by id
NameTypeDescription
eventIdnumberThe id of the event to unlock

update(sceneActive)

Update the map
NameTypeDescription
sceneActivebooleanIf the scene is active

updateEvents()

Update events

updateInterpreter()

Update the interpreter

updateParallax()

Update the parallax

updateScroll()

Update the map scroll

updateVehicles()

Update vehicles

vehicle(type)Game_Vehicle | null

Get a vehicle by type
NameTypeDescription
typestring|numberEither string or number type of the vehicle (0/1/2 or boat/ship/airship)
Returns:
TypeDescription
Game_Vehicle|nullThe game vehicle object, or null if invalid type

vehicles()Array.<Game_Vehicle>

Get the vehicle array
Returns:
TypeDescription
Array.<Game_Vehicle>Array of game vehicles

width()number

Get the map width
Returns:
TypeDescription
numberThe width

xWithDirection(x, d)number

Get the x value with direction
NameTypeDescription
xnumberThe original x value
dnumberThe direction
Returns:
TypeDescription
numberThe x value after direction accounted for

yWithDirection(y, d)number

Get the y value with direction
NameTypeDescription
ynumberThe original y value
dnumberThe direction
Returns:
TypeDescription
numberThe y value after direction accounted for