FLAG 3.0 GET

Scene

The Scene assembles all game assets created in POLE and prepares them to be rendered by FLAG. You can create multiple Scenes in POLE., however, FLAG only loads and displays one Scene at a time. All Scene assets can be manipulated using FLAG and WIND.

Class

FLAGSCENE

Called by FLAG.Scene

Example Use FLAG.Scene to create custom functions that run on the loaded Scene.
FLAG.Scene.update = function(){
console.log("This Scene is updating.");
};
Extend Class Example
FLAGSCENE.prototype.myFunction = function(){
console.log("I added to the FLAGSCENE Class");
};

Properties

actors:Array --- A list of Actor instances in the Scene alpha:Number --- Overall alpha of Scene bgColor:Hexadecimal --- Color for Scene background bgImage:Image --- Static background image for Scene dragging:Boolean --- True if Scene Map is currently being dragged gravity:b2Vec2 --- Box2D gravity setting for the Scene
x:Number --- Horizontal gravity y:Number --- Vertical gravity
images:Array --- A list of images used in Scene layers:Array --- A list of Objects that contain layer data
tileIDs:Array --- Array for Tiles tileSheetIDs:Array --- Array for Tile Sheets tiledObjectIDs:Array --- Array for Tiled Objects offset:Object --- Offset of layer relative to the Map x:Number --- Horizontal offset y:Number --- Vertical offset offsetScroll:Object --- Offset of layer relative to viewport, used for parallax effect x:Number --- Horizontal scroll offset y:Number --- Vertical scroll offset visible:Boolean --- True if layer is rendered alpha:Number --- Alpha of layer drawTileBounds:Object --- Used for tile reduction in Orthogonal and Hexagonal Maps tilesToDrawIso:Array --- Used for tile reduction in Isometric Maps preRender:Object --- Toggles and holds a pre-rendered layer on:Boolean --- True if layer is pre-rendered, default is false canvas:Object --- Canvas that holds the image of the pre-render layer
loadInterval:Function --- Interval for loading of Scene Map:Object --- Holds Scene Map
type:String --- "orthogonal","isometric", or "hexagonal" x:Number --- Horizontal location of Map y:Number --- Vertical location of Maps w:Number --- Pixel width of Map h:Number --- Pixel height of Map gridPoints:Array --- Array of point used for tile locations lastX:Number --- Previous horizontal location of Map lastY:Number --- Previous vertical location of Map tileWidth:Number --- Width of tiles tileHeight:Number --- Height of tiles tilesWide:Number --- Number of tiles wide tilesHigh:Number --- Number of tiles high camLoc:Object --- Map location in the center of the viewport x:Number --- Horizontal Map location in the center of the viewport y:Number --- Vertical Map location in the center of the viewport
name:String --- Name of the Scene pIndex:Number --- Index of Scene created in POLE scale:Number --- Scale of the Scene sprites:Array --- A list of Sprite instances in the Scene spriteSheets:Array --- A list of Sprite Sheets tiledObjects:Array --- A list of Tiled Object instances in the Scene tiledObjectSheets:Array --- A list of Tiled Object Sheets tileSheets:Array --- A list of Tile Sheets tileSprites:Array --- A list of Tile Sprites tweens:Array --- A list of active Tweens in the Scene useWTC:Boolean --- Include auto generated walkable tile colliders for Box2D walkableTiles:Array --- Walkable tile list, 1 can be walked on, 0 can not worldColliders:Array --- List of world colliders for Box2D

Methods

Create Sprite Sheet

Returns a Sprite Sheet defined in POLE and prepares it for use in the Scene.

FLAG.Scene.createSpriteSheet( pIndex:Number ); Parameters pIndex:Number --- Index of Sprite Sheet created in POLE

Create Tiled Object Sheet

Returns a Tiled Object Sheet defined in POLE and prepares it for use in the Scene.

FLAG.Scene.createTiledObjectSheet( pIndex:Number ); Parameters pIndex:Number --- Index of Tiled Object Sheet created in POLE

Create Tile Sheet

Returns a Tile Sheet defined in POLE and prepares it for use in the Scene.

FLAG.Scene.createTileSheet( pIndex:Number ); Parameters pIndex:Number --- Index of Tile Sheet created in POLE

Drag Start

Enables dragging of the Scene with the Pointer.

FLAG.Scene.dragStart( ); Example
FLAG.Scene.mouseDown(e){
FLAG.Scene.dragStart();
};

Drag Stop

Disables dragging of the Scene with the Pointer.

FLAG.Scene.dragStop( ); Example
FLAG.Scene.mouseUp(e){
FLAG.Scene.dragStop();
};

Include Tiled Object

Adds a Tiled Object to the Scene's tiledObjects array, and adjusts the Scene's tileIDs and tiledObjectIDs arrays. Called by FLAG.addTiledObject

FLAG.includeTiledObject( name:String, pIndex:Number, layer:Number, row:Number, col:Number, animation:Number, frame:Number ); Parameters name:String --- Name of the Tiled Object instance pIndex:Number --- Index of the Tiled Object created in POLE layer:Number --- Layer of the Tiled Object row:Number --- Root row of the Tiled Object col:Number --- Root col of the Tiled Object animation:Number --- Animation index frame:Number --- Frame number

Key Down

Called by FLAG.keyDownHandler, use it to create custom actions that occur when a key is pressed.

FLAG.Scene.keyDown( e:Event ); Parameters e:Event --- Key down event Example
FLAG.Scene.keyDown(e){
if(e.keyCode = 32){
console.log("The spacebar is down.");
}
};

Key Up

Called by FLAG.keyUpHandler, use it to create custom actions that occur when a key is released.

FLAG.Scene.keyUp( e:Event ); Parameters e:Event --- Key up event Example
FLAG.Scene.keyUp(e){
if(e.keyCode = 32){
console.log("The spacebar is up.");
}
};

Mouse Down

Called by FLAG.mouseDown, use it to create custom actions that occur when the mouse is pressed.

FLAG.Scene.mouseDown( e:Event ); Parameters e:Event --- Mouse down event Example
FLAG.Scene.mouseDown(e){
console.log("The mouse is down.");
};

Mouse Move

Called by FLAG.mouseMove, use it to create custom actions that occur when the mouse is moved.

FLAG.Scene.mouseMove( e:Event ); Parameters e:Event --- Mouse move event Example
FLAG.Scene.mouseMove(e){
console.log("The mouse is moving.");
};

Mouse Out

Called by FLAG.mouseOut, use it to create custom actions that occur when the mouse is out.

FLAG.Scene.mouseOut( e:Event ); Parameters e:Event --- Mouse out event Example
FLAG.Scene.mouseOut(e){
console.log("The mouse is out.");
};

Mouse Up

Called by FLAG.mouseUp, use it to create custom actions that occur when the mouse is up.

FLAG.Scene.mouseUp( e:Event ); Parameters e:Event --- Mouse up event Example
FLAG.Scene.mouseUp(e){
console.log("The mouse is up.");
};

Mouse Wheel

Called by FLAG.mouseWheel, use it to create custom actions that occur when the mouse wheel is moved.

FLAG.Scene.mouseWheel( e:Event ); Parameters e:Event --- Mouse wheel event Example
FLAG.Scene.mouseWheel(e){
console.log(e.wheelDelta || -e.detail);
};

Touch Down

Called by FLAG.touchDown, use it to create custom actions that occur when a touch is pressed.

FLAG.Scene.touchDown( e:Event ); Parameters e:Event --- Touch down event Example
FLAG.Scene.touchDown(e){
console.log("A touch is down.");
};

Touch Move

Called by FLAG.touchMove, use it to create custom actions that occur when a touch is moved.

FLAG.Scene.touchMove( e:Event ); Parameters e:Event --- Touch move event Example
FLAG.Scene.touchMove(e){
console.log("A touch is moving.");
};

Touch Out

Called by FLAG.touchOut, use it to create custom actions that occur when a touch is out.

FLAG.Scene.touchOut( e:Event ); Parameters e:Event --- Touch out event Example
FLAG.Scene.touchOut(e){
console.log("A touch is out.");
};

Touch Up

Called by FLAG.touchUp, use it to create custom actions that occur when a touch is up.

FLAG.Scene.touchUp( e:Event ); Parameters e:Event --- Touch up event Example
FLAG.Scene.touchUp(e){
console.log("A touch is up.");
};

Update

Called by FLAG.update, use it to create custom actions that occur each tick of the game loop.

FLAG.Scene.update( ); Example
FLAG.Scene.update(){
console.log("The Scene has been updated.");
};
POLE WIND