Read our article on Backgrounds and Camera for an explanation of some of these blocks.
Returns the camera's horizontal (X) or vertical (Y) position.
getScreenX()
getScreenY()
getScreenXCenter()
getScreenYCenter()
Returns the game's screen width/height.
getScreenWidth()
getScreenHeight()
Moves the camera to the given point.
engine.moveCamera([NUMBER], [NUMBER]);
Moves the camera to the given actor's location.
engine.cameraFollow([ACTOR]);
Shakes the screen for the specified time. Good for conveying explosions or earthquakes. Intensity specifies how "violent" the shaking is.
startShakingScreen([NUMBER] / 100, [NUMBER]);
Immediately stop shaking the screen.
stopShakingScreen();
Changes the background color to a solid color (if you don't have an image background covering it up).
setColorBackground([COLOR]);
Changes the background color to a vertical gradient (if you don't have an image background covering it up).
setColorBackground([COLOR], [COLOR]);
Returns true if a layer with the given name or ID exists.
(engine.getLayerById([INT], false) != null)
(engine.getLayerByName([TEXT], false) != null)
Changes the speed that the specified background layer (automatically) scrolls at. The layer must be designated as scrolling to begin with for this to work.
setScrollSpeedForBackground(engine.getLayerById([INT]), [NUMBER], [NUMBER]);
setScrollSpeedForBackground(engine.getLayerByName([TEXT]), [NUMBER], [NUMBER]);
Change the speed at which any layer scrolls, as a percentage of the baseline. In other words, 100% is the original value, 200% is twice as much and 50% is half as much.
setScrollFactorForLayer(engine.getLayerById([INT]), [NUMBER], [NUMBER]);
setScrollFactorForLayer(engine.getLayerByName([TEXT]), [NUMBER], [NUMBER]);
Shows/Hides the given layer.
hideTileLayer(engine.getLayerById([INT]));
hideTileLayer(engine.getLayerByName([TEXT]));
showTileLayer(engine.getLayerById([INT]));
showTileLayer(engine.getLayerByName([TEXT]));
Fades the given layer to the specified opacity value (0 - 100%) over time.
fadeTileLayerTo(engine.getLayerById([INT]), [NUMBER]/100, [NUMBER]);
fadeTileLayerTo(engine.getLayerByName([TEXT]), [NUMBER]/100, [NUMBER]);
Returns the opacity of layer (0% - 100%) with the given name or ID.
getTileLayerOpacity(engine.getLayerById([INT]))
getTileLayerOpacity(engine.getLayerByName([TEXT]))
Set the Blend Mode for the specified layer.
setBlendModeForLayer(engine.getLayerById([INT]),[BLEND MODE]);
setBlendModeForLayer(engine.getLayerByName([TEXT]),[BLEND MODE]);
Change the image displayed in the specified background layer.
changeBackgroundImage(engine.getLayerById([INT]), [IMAGE]);
changeBackgroundImage(engine.getLayerByName([TEXT]), [IMAGE]);
Add a new layer for tiles and actors. Provide the name of the new layer and the drawing order (z-order). 0 is the back, higher numbers display on top.
addTileLayer([TEXT], [INT]);
Add a new background layer. Provide the name, the name of the Background resource and the drawing order (z-order). 0 is the back, higher numbers display on top.
addBackground([TEXT], [TEXT], [INT]);
Add a new background layer using an image. Provide the image, name and drawing order (z-order). 0 is the back, higher numbers display on top.
addBackgroundFromImage([IMAGE], true, [TEXT], [INT]); //tiled background
addBackgroundFromImage([IMAGE], false, [TEXT], [INT]); //regular background
Remove the specified layer. The behavior of objects that still exist on this layer when it is removed is unspecified.
engine.removeLayer(engine.getLayerById([INT]));
engine.removeLayer(engine.getLayerByName([TEXT]));
Set the drawing order of the specified layer. 0 is the back, higher numbers display on top.
engine.moveLayerToOrder(engine.getLayerById([INT]), [INT]);
engine.moveLayerToOrder(engine.getLayerByName([TEXT]), [INT]);
Get the drawing order of the specified layer. 0 is the back, higher numbers display on top.
engine.getOrderOfLayer(engine.getLayerById([INT]))
engine.getOrderOfLayer(engine.getLayerByName([TEXT]))
Returns the number of layers in the current scene.
engine.getNumberOfLayers()
Used to set how far actors have to be off-screen to be considered off screen.
setOffscreenTolerance([NUMBER], [NUMBER], [NUMBER], [NUMBER]);