Inherits from Node
Location aphid.g2d.SpriteBatchNode

Overview

The SpriteBatchNode is a special container for fast rendering multiple sprites with the same texture. The sprites may display different area of the texture.

Using SpriteBatchNode may boost the rendering performance by 50%~200% than using normal Node class.

Notes: SpriteBatchNode only supports sprites with the same texture as its subnodes. Otherwise a JavaScript exception is thrown out.

Overview of Constructors

Overview of Tasks

Attributes

  • Type
  • Texture2D
  • Writability
  • readwrite

Functions

  • Return Type
  • SpriteBatchNode

Constructors

SpriteBatchNode(texture, [capacity])

new SpriteBatchNode(Texture2D texture, [int capacity])

Parameters

Non-null Texture2D texture
Optional int capacity

Attributes

texture

Non-null readwrite Texture2D texture

Functions

addChild(child, [z], [tag])

Adds a sprite with the same texture as a subnode.

SpriteBatchNode addChild(Sprite child, [int z], [int tag])

Parameters

Non-null Sprite child

The child sprite MUST have the same texture as the SpriteBatchNode has.

Optional int z
Optional int tag

Return Value: SpriteBatchNode

Returns the same receiver for method chaining