-
Notifications
You must be signed in to change notification settings - Fork 8
Stages
-
id
the ID (really just an index, starting at 0) of the room -
x
the x-position, in tiles, of the left side of the room, relative to the world -
y
the y-position, in tiles, of the top side of the room, relative to the world -
width
the width of the room (in tiles) -
height
the height of the room (in tiles) -
cameraBounds
a bounding structure for where the camera can move within the room -
tile
array of tile indicies; these correspond to the map's tileset's indicies -
attr
array of tile attributes -
enemies
array of enemy instance structures -
items
array of item instance structures -
transitions
array of room transition structures
This example room is located at (0, 0) and is 10 by 4 tiles in size. The camera bounding box is as large as the room itself, which means the camera can move freely through the entire room.
{
"id" : 0,
"x" : 0,
"y" : 0,
"width" : 10,
"height" : 4,
"cameraBounds" : {
"x" : 0,
"y" : 0,
"width" : 10,
"height" : 4
},
"tile" : [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
],
"attr" : [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
],
"enemies" : [],
"items" : [],
"transitions" : []
}
Transitions join two rooms to each other. A room may have many transitions, each placed anywhere. When the player enters a transition's bounds (called the "transition region"), the camera pans to the next room specified by the transition. With the exception of "boss doors" (a special type of transition), the player must be fully inside the transition region in order for it to trigger a transition.
-
door
(optional) boolean denoting whether this transition is a "door" or not. false by default. -
to
the id of the room this causes a transition to. -
width
the width, in tiles, of this transition region. -
height
the height, in tiles, of this transition region. -
x
the x position, in tiles, of the left side of the transition region. -
y
the y position, in tiles, of the top side of the transition region. -
direction
(one of "up", "forward", "down", "backward") the direction in which the transition moves the camera. In this case, "forward" means "to the right" and "backward" means "to the left". If any other value is supplied then the transition is a "teleport" transition, which means that the camera will instantly move to the next room.
Items and enemies can be added to each room within the items
and enemies
properties of each room in a stage. This causes the room to create "spawners" for each item and enemy declared. Item and Enemy delcarations contain the name of the object template, plus some instance-level configuration values to be applied when the entity is spawned at runtime. The size of the spawner is determined by the size of the bounding box from the object template.
Spawners can be configured to spawn multiple instances of their enemy at a specific rate, much like the beginning room in Crash/Clash Man's stage in Mega Man 2. This is useful for things like spawning Tellys over and over, until a set number have been spawned, only backfilling when one of them is destroyed.
-
type
{String} the name of the Item or Enemy object template to spawn -
x
{Number} the X coordinate, in pixels, of where the spawner should be located, relative to the room -
y
{Number} the Y coordinate, in pixels, of where the spawner should be located, relative to the room -
direction
{String} Enemies only the direction to face ("Left" or "Right") -
spawnLimit
{Number} Enemies only the maximum number of enemy instances to spawn at a single time -
spawnRate
{Number} Enemies only the rate (time, in seconds) at which enemies are spawned -- basically the cooldown between spawning enemies from a single spawner -
continuous
{Boolean} Enemies only flag indicating whether spawning happens continuously. This must be set totrue
in order forspawnLimit
andspawnRate
to be respected
This example shows two items being spawned, an Extra Life and an E-Tank. It also shows two enemies being spawned, both Metools, but with different locations and default directions.
"items": [
{
"type": "Extra Life",
"x": 20,
"y": 168
},
{
"type": "E-Tank",
"x": 984,
"y": 184
}
],
"enemies": [
{
"type": "Metool",
"x": 16,
"y": 16,
"direction": "Right"
},
{
"type": "Metool",
"x": 64,
"y": 16,
"direction": "Left"
}
]
Below is another example showing how to spawn multiple enemies from the same spawn point, backfilling if any of the spawned enemies is destroyed. This is similar to the first room of Crash/Clash Man's stage where Tellies keep spawning after you destroy them. This example instance will spawn up to 3 Telly enemies and then stop spawning until one or more of them is destroyed.
"enemies": [
{
"type": "Telly",
"x": 32,
"y": 32,
"direction": "Left",
"spawnLimit": 3,
"spawnRate": 3,
"continuous": true
}
]