Functions Summary
SceneObject.addBehavior (behaviorClass)
Add a behavior to the scene objectSceneObject.addSprite (sprite, offset, index)
Add a sprite to the scene objectSceneObject.clone (positionX, positionY)
Clone the scene objectSceneObject.drawToImage (imageName, replace)
Draw a SceneObject to an image in CPU memory.SceneObject.fadeIn (time, callback)
Fade in effect, gradually changing the opacity (alpha) of the all the sprites of this object from 0 to 1. If any sprite is invisible, it is set to visible before fading in.SceneObject.fadeOut (time, callback)
Fade out effect, gradually changing the opacity (alpha) of the all the sprites of this object from 1 to 0. After fading out, all sprites are set to invisible.SceneObject.getAlignment ()
Get the screen alignment of a scene object. This determines where the object is positioned following a resize eventSceneObject.getAngularVelocity ()
Get the current angular velocity of the objectSceneObject.getBehavior (name)
Get a behavior of the scene objectSceneObject.getBehaviorByIndex (index)
Get a behavior of the scene object, give its index in the array of behaviorsSceneObject.getBehaviors ()
Get an array containing all the behaviors of this objectSceneObject.getBoundingBox ()
Get the axis-aligned bounding box that contains all the sprites of this SceneObjectSceneObject.getFlowChart ()
Get a reference to the current flow chart data structure associated with this SceneObject. This will be null unless it was set via setFlowChart, or via the SceneObject constructor.SceneObject.getFunctionsScript ()
Get the script (as a string) that defines the functions associated with this object when it was constructed or the last time importFunctions was calledSceneObject.getGrid ()
Get a copy of the grid properties of the SceneObjectSceneObject.getGridRef ()
Get a reference to the grid properties of the SceneObjectSceneObject.getMovementSpeed ()
Get the scene object's movement speedSceneObject.getName ()
Get the current name of this object, if it was set when the object was created or with SceneObject.setName()SceneObject.getOverlappingObjects (searchAllLayers, precision)
Get an array of objects overlapping this objectSceneObject.getPath ()
Get the currently active Path for this SceneObjectSceneObject.getPosition ()
Get the world space position of the scene objectSceneObject.getRotation ()
Get the current rotation angle of the scene objectSceneObject.getScreenBoundingBox ()
Get the axis-aligned bounding box that contains all the sprites of this SceneObject in screen spaceSceneObject.getSprite (index)
Get the sprite object corresponding to a given sprite indexSceneObject.getSpriteAtPosition (screenPosition)
Get a sprite of the scene object at a given screen position (if there is one).
SceneObject.getSpriteByName (name)
Get a sprite object given its nameSceneObject.getSpriteCount ()
Get the number of sprites in the scene objectSceneObject.getSpriteIndex (sprite)
Get the current index of a spriteSceneObject.getSpriteOffset (indexOrName)
Get the position of a sprite relative to the position of its parent scene objectSceneObject.getTargetPosition ()
Get the position where the scene object is moving toSceneObject.getTargetRotation ()
Get the rotation angle the scene object is rotating to. Note that if there is no target rotation angle, this will simply return the current rotation angle of the object.SceneObject.getVelocity ()
Get the current linear velocity of the objectSceneObject.importFunctions (functionObject)
Import functions from an object that contains their string representationsSceneObject.interval (time, functionName, data, variance)
Schedule the execution and processing of a function for this object, repeating it periodically. The scheduled function will be cancelled when the object is removed from the scene, or when SceneObject.unschedule is calledSceneObject.isAnimating ()
Check whether any sprite in the scene object is playing any animationSceneObject.isInScene ()
Check whether the scene object is in the sceneSceneObject.isListeningFor (eventName)
Check if the object is currently listening for a specific type of event. This is the same as calling wade.isEventListener(SceneObject, eventName)SceneObject.isMoving ()
Check whether the scene object is currently movingSceneObject.isOnScreen ()
Check whether the SceneObject is currently visible on the screenSceneObject.isTemplate ()
Check whether this object is a template. A template is a scene object that never receives any events, and is set to be invisible as soon as it's added to the sceneSceneObject.isVisible (checkAllSprites)
Check if a scene object is visible. This returns true if at least one of the child sprites is visible, unless you set checkAllSprites to true, in which case this function only returns true if all sprites are visible.SceneObject.listenFor (eventName)
Start listening for an event. This is the same as calling wade.addEventListener(SceneObject, eventName)SceneObject.moveTo (posX, posY, speed)
Move a scene object to the specified world space position, with a given speedSceneObject.overlapsObject (object, precision)
Check whether this scene object overlaps another scene objectSceneObject.overlapsSprite (sprite, precision)
Check whether this scene object overlaps a spriteSceneObject.playAnimation (name, direction)
Play an animation on all the sprites of the scene object that have an animation with a matching nameSceneObject.process (functionName, data)
Execute a function of this object and its behaviors. If the scene object or any of its behaviors have member functions matching the functionName parameter, those functions will be called and will be passed the data parameterSceneObject.processEvent (eventName, eventData)
Process an event for the scene object and all its behaviors. If the scene object or any of its behaviors have member functions matching the eventName parameter, those functions will be called, passing the eventData parameterSceneObject.removeAllSprites ()
Remove all the sprites from the scene object.SceneObject.removeBehavior (name)
Remove a behavior from a scene objectSceneObject.removeBehaviorByIndex (index)
Remove a behavior from a scene object, using the behavior indexSceneObject.removeSprite (sprite)
Remove a sprite from the scene objectSceneObject.removeSpriteByIndex (index)
Remove a sprite from the scene object, given a sprite indexSceneObject.resumeAnimation ()
Resume playing any animations that had been stoppedSceneObject.rotateTo (angle, angularVelocity)
Gradually rotate an object towards a target angleSceneObject.schedule (time, functionName, data)
Schedule the execution and processing of a function for this object. The scheduled function will be cancelled when the object is removed from the scene, or when SceneObject.unschedule is calledSceneObject.serialize (stringify, propertiesToExclude, serializeFunctions)
Export this SceneObject to an object that can then be used to create a new SceneObject like this one (by passing the resulting object to the SceneObject constructor).SceneObject.setAlignment (leftRight, topBottom)
Set the screen alignment of a scene object. This determines where the object is positioned following a resize eventSceneObject.setAngularVelocity (velocity)
Set the angular velocity of the object.SceneObject.setAsTemplate (toggle)
Set a scene object to be a template. A template is a scene object that never receives any events, and is set to be invisible as soon as it's added to the scene. By default, scene objects are note templates.SceneObject.setFlowChart (flowChartData)
Assigns a flow chart to this SceneObject. If the object is already in the scene, the flow chart is executed immediately. If the object is not in the scene, the flow chart is executed the next time (and every time) the object is added to the scene.SceneObject.setGrid (gridData)
Change the grid properties of the SceneObjectSceneObject.setName (name)
Set a name for the scene object, so it can be retrieved via wade.getSceneObject(). Note that you can't have more objects with the same name in the scene at the same time.SceneObject.setPath (path, setInitialValues, speedMultiplier)
Set the currently active Path for this SceneObject. The SceneObject will start following the path immediately.SceneObject.setPosition (positionX, positionY)
Set the world space position of the scene object. The position of all its sprites will be updated accordingly.SceneObject.setRotation (rotation)
Set a rotation angle for the scene objectSceneObject.setSpriteOffset (indexOrName, offset)
Set the position of a sprite relative to the position of the scene objectSceneObject.setSpriteOffsets (spriteOffsets)
Set the world space position offsets for the sprites of the scene object (i.e. the sprite positions relative to the scene object's position)SceneObject.setVelocity (velocityX, velocityY)
Set the current linear velocity of the object. Note that calling this function on an object that is moving towards a specific target (that had been set with a call to moveTo) will cancel the current movement towards the target.SceneObject.setVisible (toggle)
Show or hide a scene objectSceneObject.step ()
Perform a simulation step for the scene object.
SceneObject.stopAnimation ()
Stop any animations that are currently playingSceneObject.stopListeningFor (eventName)
Stop listening for an event. This is the same as calling wade.removeEventListener(SceneObject, eventName)SceneObject.stopMoving ()
Stop a scene object that is currently moving. An 'onMoveComplete' event will be triggered.SceneObject.toGrid (numColumns, numRows, marginX, marginY)
Create a grid of clones of this SceneObject. This SceneObject becomes the top-left element of the gridSceneObject.unschedule (eventName)
Cancel any scheduled events with the given name for this object
Function Details
SceneObject.addBehavior (behaviorClass)
Add a behavior to the scene object
behaviorClass : The definition of a behavior function. Note that this is not the same as an instance of a behavior function.
Returns Object : The instance of the behavior function that was just added to the object.^
SceneObject.addSprite (sprite, offset, index)
Add a sprite to the scene object
Sprite sprite : The sprite to add
object offset (optional): An object with 'x' and 'y' fields representing the position offset and an 'angle' field representing the angular offset. If omitted or falsy, the offset will be (0, 0, 0). If any of the fields is omitted, its value will be 0.
number index (optional): Where to add the sprite. If omitted, the sprite will be added after any sprites already present in this scene object. If 'index' is greater than the number of sprites currently present in the scene object, the sprite will be added at the end. Check the returned value to determine the actual index that was used.
Returns number : The index of the sprite that was just added^
SceneObject.clone (positionX, positionY)
Clone the scene object
number positionX (optional): The new X coordinate for the clone's position. If omitted the X coordinate of the original object is used
number positionY (optional): The new Y coordinate for the clone's position. If omitted the Y coordinate of the original object is used
Returns object : A copy of the scene object. Note that the new object won't be automatically added to the scene, even if the object you are cloning was in the scene.^
SceneObject.drawToImage (imageName, replace)
Draw a SceneObject to an image in CPU memory.
string imageName : The target image name
boolean replace (optional): Whether to replace any existing image with that name. Set this to false to draw on top of an existing image.^
SceneObject.fadeIn (time, callback)
Fade in effect, gradually changing the opacity (alpha) of the all the sprites of this object from 0 to 1. If any sprite is invisible, it is set to visible before fading in.
number time : How many seconds the transition should last. Note that this won't be extremely accurate - to make the effect smooth, it must ultimately depend on the actual frame rate of the app.
function callback (optional): A function to execute when the transition is over^
SceneObject.fadeOut (time, callback)
Fade out effect, gradually changing the opacity (alpha) of the all the sprites of this object from 1 to 0. After fading out, all sprites are set to invisible.
number time : How many seconds the transition should last. Note that this won't be extremely accurate - to make the effect smooth, it must ultimately depend on the actual frame rate of the app.
function callback (optional): A function to execute when the transition is over^
SceneObject.getAlignment ()
Get the screen alignment of a scene object. This determines where the object is positioned following a resize event
Returns Object : An object whose 'x' and 'y' fields represent the alignment of the scene object. If the alignment is set, valid values are 'left' and 'right' for the 'x' field, and 'top' and 'bottom' for the 'y' field^
SceneObject.getAngularVelocity ()
Get the current angular velocity of the object
Returns number : The angular velocity of the object, in radians per second^
SceneObject.getBehavior (name)
Get a behavior of the scene object
string name (optional): The name of the behavior to get.
Returns Object : The requested behavior. If the 'name' parameter is omitted or falsy, the first behavior that was registered with the scene object.^
SceneObject.getBehaviorByIndex (index)
Get a behavior of the scene object, give its index in the array of behaviors
number index (optional): The index of the sprite to retrieve
Returns Object : The requested behavior. Note that this is an instance of the behavior, not the behavior class that was passed to the SceneObject's constructor.^
SceneObject.getBehaviors ()
Get an array containing all the behaviors of this object
Returns Array : An array containing all the behaviors of this object.^
SceneObject.getBoundingBox ()
Get the axis-aligned bounding box that contains all the sprites of this SceneObject
Returns object : An object with minX, minY, maxY and maxY properties describing the bounding box in world space. If the scene object has no sprites, an object where all properties are set to 0 is returned.^
SceneObject.getFlowChart ()
Get a reference to the current flow chart data structure associated with this SceneObject. This will be null unless it was set via setFlowChart, or via the SceneObject constructor.
Returns Object : The flow chart data. See the documentation of wade.runFlowChart() for details.^
SceneObject.getFunctionsScript ()
Get the script (as a string) that defines the functions associated with this object when it was constructed or the last time importFunctions was called
Returns string : The source of the functions script^
SceneObject.getGrid ()
Get a copy of the grid properties of the SceneObject
Returns Object : The grid properties of the SceneObject^
SceneObject.getGridRef ()
Get a reference to the grid properties of the SceneObject
Returns Object : The grid properties of the SceneObject^
SceneObject.getMovementSpeed ()
Get the scene object's movement speed
Returns number : The current movement speed^
SceneObject.getName ()
Get the current name of this object, if it was set when the object was created or with SceneObject.setName()
Returns string : The name of this object^
SceneObject.getOverlappingObjects (searchAllLayers, precision)
Get an array of objects overlapping this object
boolean searchAllLayers (optional): Whether to extend the search to all layers. This is false by default, meaning that only overlapping sprites on the same layer will be considered.
string precision (optional): How accurately to search for overlaps. This can be either 'axis-aligned' (which would consider the axis-aligned bounding box of the sprites), or 'oriented', which takes into account the rotation of each sprite. Default is 'axis-aligned'.
Returns SceneObjectGroup : A SceneObjectGroup containing all the objects that are overlapping this object^
SceneObject.getPath ()
Get the currently active Path for this SceneObject
Returns Path : The currently active path.^
SceneObject.getPosition ()
Get the world space position of the scene object
Returns Object : An object with 'x' and 'y' field representing world space coordinates^
SceneObject.getRotation ()
Get the current rotation angle of the scene object
Returns number : The current rotation angle in radians. A positive value indicates a clockwise rotation^
SceneObject.getScreenBoundingBox ()
Get the axis-aligned bounding box that contains all the sprites of this SceneObject in screen space
Returns object : An object with minX, minY, maxY and maxY properties describing the bounding box in screen space. If the scene object has no sprites, an object where all properties are set to 0 is returned.^
SceneObject.getSprite (index)
Get the sprite object corresponding to a given sprite index
number|string index (optional): The sprite index or the sprite name. If omitted or falsy, the first sprite is returned.
Returns Sprite|undefined : The sprite object^
SceneObject.getSpriteAtPosition (screenPosition)
Get a sprite of the scene object at a given screen position (if there is one).
Note that at most one sprite will be returned. If more sprites are present at the same screen position, the one at the front will be returned.
Object screenPosition : A position object, with 'x' and 'y' coordinates
Returns Object : An object with the following fields:
isPresent - A boolean that describes whether any sprite was found
topLayer - The id of the top layer where a sprite was found
spriteIndex - The index of the sprite that was found. You can use this to get the sprite object with a call to getSprite^
SceneObject.getSpriteByName (name)
Get a sprite object given its name
string name : The name of the sprite
Returns Sprite : The sprite object corresponding to the given name^
SceneObject.getSpriteCount ()
Get the number of sprites in the scene object
Returns number : The number of sprites^
SceneObject.getSpriteIndex (sprite)
Get the current index of a sprite
Sprite sprite : The sprite to look for
Returns number : The index of the sprite^
SceneObject.getSpriteOffset (indexOrName)
Get the position of a sprite relative to the position of its parent scene object
number indexOrName (optional): The sprite index or a string representing the sprite name. If omitted or falsy, the first sprite offset is returned.
Returns Object : An object with 'x' and 'y' fields representing the position offset and an 'angle' field representing the angular offset^
SceneObject.getTargetPosition ()
Get the position where the scene object is moving to
Returns Object : An object with 'x' and 'y' fields representing a world space position, or null if no target position is set^
SceneObject.getTargetRotation ()
Get the rotation angle the scene object is rotating to. Note that if there is no target rotation angle, this will simply return the current rotation angle of the object.
Returns number : The target rotation angle^
SceneObject.getVelocity ()
Get the current linear velocity of the object
Returns {x: number, y: number} : An object with x and y fields representing the linear velocity of the object^
SceneObject.importFunctions (functionObject)
Import functions from an object that contains their string representations
Object functionObject : An object in the format {functionName1: functionCode1, functionName2: functionCode2, ...} where functionCode is always a string.^
SceneObject.interval (time, functionName, data, variance)
Schedule the execution and processing of a function for this object, repeating it periodically. The scheduled function will be cancelled when the object is removed from the scene, or when SceneObject.unschedule is called
number time : How many milliseconds to wait between function calls
string functionName : The name of the function to execute for this object. If the object or any of its behaviors have a function with this name, it will be executed
object data (optional): The data to pass to the event function
number variance (optional): A maximum amount of milliseconds to randomly add or subtract to the time parameter^
SceneObject.isAnimating ()
Check whether any sprite in the scene object is playing any animation
Returns Boolean : Whether any sprite in the scene object is playing any animation^
SceneObject.isInScene ()
Check whether the scene object is in the scene
Returns boolean : Whether the scene object is in the scene^
SceneObject.isListeningFor (eventName)
Check if the object is currently listening for a specific type of event. This is the same as calling wade.isEventListener(SceneObject, eventName)
string eventName : The name of the event
Returns boolean : Whether the object is currently listening for the event^
SceneObject.isMoving ()
Check whether the scene object is currently moving
Returns boolean : Whether the scene object is currently moving^
SceneObject.isOnScreen ()
Check whether the SceneObject is currently visible on the screen
Returns boolean : Whether the SceneObject is currently visible on the screen^
SceneObject.isTemplate ()
Check whether this object is a template. A template is a scene object that never receives any events, and is set to be invisible as soon as it's added to the scene
Returns boolean : whether this object is a template^
SceneObject.isVisible (checkAllSprites)
Check if a scene object is visible. This returns true if at least one of the child sprites is visible, unless you set checkAllSprites to true, in which case this function only returns true if all sprites are visible.
boolean checkAllSprites (optional, defaults to false): Whether to check all sprites
Returns boolean : Whether the SceneObject is currently visible^
SceneObject.listenFor (eventName)
Start listening for an event. This is the same as calling wade.addEventListener(SceneObject, eventName)
string eventName : The name of the event^
SceneObject.moveTo (posX, posY, speed)
Move a scene object to the specified world space position, with a given speed
number posX : The X coordinate of the target position
number posY : The Y coordinate of the target position
number speed : The movement speed, in world space units per second^
SceneObject.overlapsObject (object, precision)
Check whether this scene object overlaps another scene object
SceneObject object : The other scene object to test
string precision (optional): How accurate the test should be. This could be 'axis-aligned' (the default value when this parameter is omitted), which only considers the axis-aligned bounding boxes of both Sprites; 'oriented' which takes into account the rotations of both Sprites; or 'pixel' that does a (much slower) per-pixel test, discarding transparent pixels.
Returns boolean : Whether the two scene objects overlap each other^
SceneObject.overlapsSprite (sprite, precision)
Check whether this scene object overlaps a sprite
Sprite sprite : The sprite to test
string precision (optional): How accurate the test should be. This could be 'axis-aligned' (the default value when this parameter is omitted), which only considers the axis-aligned bounding boxes of both Sprites; 'oriented' which takes into account the rotations of both Sprites; or 'pixel' that does a (much slower) per-pixel test, discarding transparent pixels.*
Returns boolean : Whether the scene object and the sprite overlap each other^
SceneObject.playAnimation (name, direction)
Play an animation on all the sprites of the scene object that have an animation with a matching name
string name : The animation name
string direction (optional): The direction of the animation. It can be 'forward', 'reverse' or 'ping-pong' (which means forward and then reverse). Default is 'forward'^
SceneObject.process (functionName, data)
Execute a function of this object and its behaviors. If the scene object or any of its behaviors have member functions matching the functionName parameter, those functions will be called and will be passed the data parameter
string functionName : The name of the function(s) to execute
data (optional): The data to pass to the functions. This can be any type and is optional.
Returns boolean : Whether any of the functions called returned a truthy value.^
SceneObject.processEvent (eventName, eventData)
Process an event for the scene object and all its behaviors. If the scene object or any of its behaviors have member functions matching the eventName parameter, those functions will be called, passing the eventData parameter
string eventName : The name of the event to process
Object eventData (optional): The data to pass to the functions that will be called
Returns Boolean : Whether any of the functions called return a truthy value.^
SceneObject.removeAllSprites ()
Remove all the sprites from the scene object.^
SceneObject.removeBehavior (name)
Remove a behavior from a scene object
string name : The name of the behavior to remove
Returns boolean : Whether any behavior with the specified name was found and removed^
SceneObject.removeBehaviorByIndex (index)
Remove a behavior from a scene object, using the behavior index
number index : The index of the behavior to remove^
SceneObject.removeSprite (sprite)
Remove a sprite from the scene object
Sprite sprite : The sprite to remove^
SceneObject.removeSpriteByIndex (index)
Remove a sprite from the scene object, given a sprite index
number index : The sprite to remove^
SceneObject.resumeAnimation ()
Resume playing any animations that had been stopped^
SceneObject.rotateTo (angle, angularVelocity)
Gradually rotate an object towards a target angle
number angle : The target angle (in radians)
number angularVelocity : The angular velocity (in radians per second)^
SceneObject.schedule (time, functionName, data)
Schedule the execution and processing of a function for this object. The scheduled function will be cancelled when the object is removed from the scene, or when SceneObject.unschedule is called
number time : How many milliseconds to wait before firing the event
string functionName : The name of the function to execute for this object. If the object or any of its behaviors have a function with this name, it will be executed
object data (optional): The data to pass to the event function^
SceneObject.serialize (stringify, propertiesToExclude, serializeFunctions)
Export this SceneObject to an object that can then be used to create a new SceneObject like this one (by passing the resulting object to the SceneObject constructor).
boolean stringify (optional): Whether the resulting object should be serialized to JSON. If this is set to true, this function returns a string representation of the scene object.
Array propertiesToExclude (optional): An array of strings that contains the name of the properties of this SceneObject that you do NOT want to export.
boolean serializeFunctions (optional): Whether to serialize functions (such as onMouseDown, etc). False by default
Returns object|string : An object that represents the current scene object^
SceneObject.setAlignment (leftRight, topBottom)
Set the screen alignment of a scene object. This determines where the object is positioned following a resize event
string leftRight (optional): If this is 'left' or 'right', the distance between the object and one edge of the screen will be kept constant after a resize event
string topBottom (optional): If this is 'top' or 'bottom', the distance between the object and one edge of the screen will be kept constant after a resize event^
SceneObject.setAngularVelocity (velocity)
Set the angular velocity of the object.
number velocity : The angular velocity of the object, in radians per second^
SceneObject.setAsTemplate (toggle)
Set a scene object to be a template. A template is a scene object that never receives any events, and is set to be invisible as soon as it's added to the scene. By default, scene objects are note templates.
boolean toggle (optional): Whether this scene object should be a template or not. If omitted, this parameter is assumed to be true.^
SceneObject.setFlowChart (flowChartData)
Assigns a flow chart to this SceneObject. If the object is already in the scene, the flow chart is executed immediately. If the object is not in the scene, the flow chart is executed the next time (and every time) the object is added to the scene. In any case, the flow chart is cancelled when the object is removed from the scene. This means that any node in the chart that is supposed to be executed when the object is not in the scene will not be executed. However the active node (even those that include asynchrnous operations) will always be fully executed.
object flowChartData : A data structure describing the flow chart. See the documentation of wade.runFlowChart() for details.^
SceneObject.setGrid (gridData)
Change the grid properties of the SceneObject
{type: string, collisionMap: Array, gridMap: Array, gridCoords: Object} gridData : The grid properties of the object.^
SceneObject.setName (name)
Set a name for the scene object, so it can be retrieved via wade.getSceneObject(). Note that you can't have more objects with the same name in the scene at the same time.
string name (optional): The name to set^
SceneObject.setPath (path, setInitialValues, speedMultiplier)
Set the currently active Path for this SceneObject. The SceneObject will start following the path immediately.
Path|string path : A Path object, or the name of a path that is currently in the scene.
boolean setInitialValues (optional): Whether the object and its sprite should be scanned to set the initial values of all properties that are used on Node 0 (the first node) of the path. Note that this effectively creates a copy of the path, it doesn't modify the original one.
number speedMultiplier (optional, defaults to 1): A factor to multiply the base speed defined in the path data^
SceneObject.setPosition (positionX, positionY)
Set the world space position of the scene object. The position of all its sprites will be updated accordingly.
number|Object positionX : A coordinate for the horizontal axis, or an object with 'x' and 'y' fields representing world space coordinates
number positionY (optional): A coordinate for the vertical axis^
SceneObject.setRotation (rotation)
Set a rotation angle for the scene object
number rotation : The rotation angle in radians. A positive value indicates a clockwise rotation^
SceneObject.setSpriteOffset (indexOrName, offset)
Set the position of a sprite relative to the position of the scene object
number indexOrName : The sprite index or the name of the sprite
Object offset (optional): An object with optional 'x' and 'y' fields representing the sprite offset and an 'angle' field representing the angular offset^
SceneObject.setSpriteOffsets (spriteOffsets)
Set the world space position offsets for the sprites of the scene object (i.e. the sprite positions relative to the scene object's position)
Object spriteOffsets : An object, or an array of objects, with optional 'x' and 'y' fields representing the position offsets and an 'angle' field representing the angular offsets^
SceneObject.setVelocity (velocityX, velocityY)
Set the current linear velocity of the object. Note that calling this function on an object that is moving towards a specific target (that had been set with a call to moveTo) will cancel the current movement towards the target.
number|{x: number, y: number} velocityX : The x component of the velocity (a number), or an object with x and y fields representing the linear velocity of the object
number velocityY : The y component of the velocity^
SceneObject.setVisible (toggle)
Show or hide a scene object
boolean toggle : Whether to show the scene object^
SceneObject.step ()
Perform a simulation step for the scene object.
This function is called automatically by WADE, that aims to maintain a constant calling rate where possible (60Hz by default).^
SceneObject.stopAnimation ()
Stop any animations that are currently playing^
SceneObject.stopListeningFor (eventName)
Stop listening for an event. This is the same as calling wade.removeEventListener(SceneObject, eventName)
string eventName : The name of the event^
SceneObject.stopMoving ()
Stop a scene object that is currently moving. An 'onMoveComplete' event will be triggered.^
SceneObject.toGrid (numColumns, numRows, marginX, marginY)
Create a grid of clones of this SceneObject. This SceneObject becomes the top-left element of the grid
number numColumns : The number of columns in the grid
number numRows : The number of rows in the grid
number marginX (optional): The horizontal spacing between columns (in world units). This is 0 by default
number marginY (optional): The vertical spacing between rows (in world units). This is 0 by default
Returns Array : A bi-dimensional array containing all grid elements. The element at column X and row Y can be accessed via returnValue[x][y]. Column and row indices start at 0^
SceneObject.unschedule (eventName)
Cancel any scheduled events with the given name for this object
string eventName : The name of the scheduled event to cancel^