Cocos2D JavaScript (v0.2.0-beta) API Documentation

Class: SpriteBatchNode

Module
cocos.nodes
Defined In
nodes/BatchNode.js
Subclasses
AtlasNode
TMXLayer
Extends
BatchNode
A BatchNode that accepts only Sprite using the same texture

Public Properties

Property Defined By
Expand anchorPoint anchorPoint : geometry.Point
Anchor point for scaling and rotation. 0x0 is top left and 1x1 is bottom right
Node
Expand anchorPointInPixels anchorPointInPixels : geometry.Point
Anchor point for scaling and rotation in pixels from top left
Node
Expand boundingBox boundingBox : geometry.Rect <read-only> Node
Expand children children : cocos.nodes.Node[]
The child Nodes
Node
Expand contentSize contentSize : geometry.Size
Size of the node
Node
Expand dirtyRegion dirtyRegion : geometry.Rect
Region to redraw
BatchNode
Expand id id : Integer <read-only>
Unique ID for this object
BObject
Expand opacity opacity : Float
Opacity of the Node. 0 is totally transparent, 255 is totally opaque
Node
Expand parent parent : cocos.nodes.Node
Parent node
Node
Expand position position : geometry.Point
Position relative to parent node
Node
Expand rotation rotation : Float
Rotation angle in degrees
Node
Expand scale scale : Float Node
Expand scaleX scaleX : Float
X scale factor
Node
Expand scaleY scaleY : Float
Y scale factor
Node
Expand tag tag : *
Unique tag to identify the node
Node
Expand texture texture : cocos.Texture2D <read-only> SpriteBatchNode
Expand visible visible : boolean
Is the node visible
Node
Expand visibleRect visibleRect : geometry.Rect <read-only>
The area of the node currently visible on screen. Returns an rect even if visible is false.
Node
Expand worldBoundingBox worldBoundingBox : geometry.Rect <read-only> Node
Expand zOrder zOrder : Integer
Nodes Z index. i.e. draw order
Node

Public Methods

Method Defined By
Expand SpriteBatchNode new SpriteBatchNode ({file:String,texture:Texture2D,textureAtlas:cocos.TextureAtlas}) : cocos.nodes.SpriteBatchNode <constructor>

Named Arguments

  • file : String
    (Optional) Path to image to use as sprite atlas
  • texture : Texture2D
    (Optional) Texture to use as sprite atlas
  • textureAtlas : cocos.TextureAtlas
    (Optional) TextureAtlas to use as sprite atlas

Returns

SpriteBatchNode
Expand addChild addChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
BatchNode
Expand addDirtyRegion addDirtyRegion (rect:*) : void

Arguments

  1. rect :

Returns

  • void
BatchNode
Expand bindTo bindTo (key:String,target:BOject,[targetKey:String],[noNotify:Boolean]) : void
Bind the value of a property on this object to that of another object so they always have the same value. Setting the value on either object will update the other too.

Arguments

  1. key : String
    Name of the property on this object that should be bound
  2. target : BOject
    Object to bind to
  3. targetKey : String (Optional)
    Key on the target object to bind to
  4. noNotify : Boolean (Optional)
    Set to true to prevent this object's property triggering a 'changed' event when adding the binding

Returns

  • void
BObject
Expand changed changed (key:*) : void

Arguments

  1. key :

Returns

  • void
BObject
Expand cleanup cleanup () : void

Returns

  • void
Node
Expand convertToNodeSpace convertToNodeSpace (worldPoint:*) : void

Arguments

  1. worldPoint :

Returns

  • void
Node
Expand detatchChild detatchChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand draw draw (ctx:*) : void

Arguments

  1. ctx :

Returns

  • void
BatchNode
Expand get get (key:String) : *
Get a property from the object. Always use this instead of trying to access the property directly. This will ensure all bindings, setters and getters work correctly.

Arguments

  1. key : String
    Name of property to get or dot (.) separated path to a property

Returns

  • *
    Value of the property
BObject
Expand getAction getAction (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand getChild getChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand nodeToParentTransform nodeToParentTransform () : void

Returns

  • void
Node
Expand nodeToWorldTransform nodeToWorldTransform () : void

Returns

  • void
Node
Expand onEnter onEnter () : void

Returns

  • void
BatchNode
Expand parentToNodeTransform parentToNodeTransform () : void

Returns

  • void
Node
Expand pauseSchedulerAndActions pauseSchedulerAndActions () : void

Returns

  • void
Node
Expand removeChild removeChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
BatchNode
Expand removeChildren removeChildren (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand reorderChild reorderChild (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand resumeSchedulerAndActions resumeSchedulerAndActions () : void

Returns

  • void
Node
Expand runAction runAction (action:*) : void

Arguments

  1. action :

Returns

  • void
Node
Expand schedule schedule ({method:String/Function,[interval:Float]}) : void
Schedules a custom method with an interval time in seconds. If time is 0 it will be ticked every frame. If time is 0, it is recommended to use 'scheduleUpdate' instead. If the method is already scheduled, then the interval parameter will be updated without scheduling it again.

Named Arguments

  • method : String/Function
    Function of method name to schedule
  • interval : Float (Optional)
    Interval in seconds

Returns

  • void
Node
Expand scheduleUpdate scheduleUpdate (opts:*) : void

Arguments

  1. opts :

Returns

  • void
Node
Expand set set (key:String,value:*) : void
Set a property on the object. Always use this instead of trying to access the property directly. This will ensure all bindings, setters and getters work correctly.

Arguments

  1. key : String
    Name of property to get
  2. value : *
    New value for the property

Returns

  • void
BObject
Expand setValues setValues (kvp:Object) : void
Set multiple propertys in one go

Arguments

  1. kvp : Object
    An Object where the key is a property name and the value is the value to assign to the property

Returns

  • void
BObject
Expand set_opacity set_opacity (newOpacity:*) : void

Arguments

  1. newOpacity :

Returns

  • void
SpriteBatchNode
Expand stopAllActions stopAllActions () : void

Returns

  • void
Node
Expand transform transform (context:*) : void

Arguments

  1. context :

Returns

  • void
Node
Expand unbind unbind (key:String) : void
Remove binding from a property which set setup using BObject#bindTo.

Arguments

  1. key : String
    Name of the property on this object to unbind

Returns

  • void
BObject
Expand unbindAll unbindAll () : void
Remove all bindings on this object

Returns

  • void
BObject
Expand unschedule unschedule (method:String/Function) : void
Unschedules a custom method

Arguments

  1. method : String/Function

Returns

  • void
Node
Expand unscheduleAllSelectors unscheduleAllSelectors () : void

Returns

  • void
Node
Expand unscheduleSelector unscheduleSelector (selector:*) : void

Arguments

  1. selector :

Returns

  • void
Node
Expand update update () : void

Returns

  • void
BatchNode
Expand visit visit (context:*) : void

Arguments

  1. context :

Returns

  • void
BatchNode
Expand worldToNodeTransform worldToNodeTransform () : void

Returns

  • void
Node

Public Events

Event Defined By
Expand onEnter onEnter () : void
Triggered when the node is added to a scene

Returns

  • void
Node
Expand onExit onExit () : void
Triggered when the node is removed from a scene

Returns

  • void
Node

Private Members

This class has no private members.