Room

Room

new Room(position, dataopt)

Source:

Create an instance of Room

Example
// returns a 40x23 tile room at position (0,0) with the name "Room 1"
const { Room } = require('lucid-dream');
const room = new Room([ 0, 0 ], {
  name: 'Room 1'
});
Parameters:
Name Type Attributes Default Description
position Array

An array representing [x,y] position

data Object <optional>
{}

An object containing the attributes to define the room.

Properties
Name Type Attributes Default Description
name String <optional>
'lvl_1'

Room name

size Array <optional>
[40,23]

An array representing [width,height] size in tiles

entities Array <optional>
[]

An array of Entity instances

triggers Array <optional>
[]

An array of Trigger instances

bgDecals Array <optional>
[]

An array of background Decal instances

fgDecals Array <optional>
[]

An array of foreground Decal instances

bgTiles Tiles <optional>
new Tiles()

A background Tiles instance

fgTiles Tiles <optional>
new Tiles()

A foregroundTiles instance

objTiles Array <optional>
new ObjectTiles()

A ObjectTiles instance

musicLayer1 Boolean <optional>
true

Is music layer 1 enabled?

musicLayer2 Boolean <optional>
true

Is music layer 2 enabled?

musicLayer3 Boolean <optional>
true

Is music layer 3 enabled?

musicLayer4 Boolean <optional>
true

Is music layer 4 enabled?

musicProgress String <optional>
''

??????????????

ambienceProgress String <optional>
''

?????????????

dark Boolean <optional>
false

Is the room dark?

space Boolean <optional>
false

Is this a space room?

underwater Boolean <optional>
false

Is the room underwater?

whisper Boolean <optional>
false

Does the whisper play in this room?

disableDownTransition Boolean <optional>
false

Can Madeline transition down in this room?

delayAltMusicFade Boolean <optional>
false

Does the alternative music fade get delayed?

music String <optional>
'music_oldsite_awake'

Room music track

altMusic String <optional>
''

Room alternative music track

windPattern String <optional>
'None'

Wind pattern for the room

color Number <optional>
0

Room color

cameraOffsetX Number <optional>
0

Room's camera offset on x axis

cameraOffsetY Number <optional>
0

Room's camera offset on y axis

Methods

toDict() → {Object}

Source:

Encode a room into a dictionary

Example
// returns encoded room dictionary
const { Room } = require('lucid-dream');
const room = new Room([ 0, 0 ], {
  name: 'Room 1'
});
room.toDict();
Returns:

An object containing the encoded room dicitonary

Type
Object