Container

Module: engine.renderer.container
new game.Container([props])

Parameters:

  • props Object (optional)

Properties

_cached Boolean (Default: false)

(No description yet)

_cachedSprite Sprite

(No description yet)

_cosCache Number (Default: 1)

(No description yet)

_interactive Boolean (Default: false)

(No description yet)

_lastTransformUpdate Number

(No description yet)

_localTransform Matrix

(No description yet)

_parent Container

(No description yet)

_rotationCache Number (Default: 0)

(No description yet)

_sinCache Number (Default: 0)

(No description yet)

_worldAlpha Number (Default: 1)

(No description yet)

_worldBounds Rectangle

(No description yet)

_worldTransform Matrix

(No description yet)

alpha Number (Default: 1)

Container opacity, 0 makes it invisible.

anchor Vector

(No description yet)

buttonMode Boolean (Default: false)

Change cursor, when mouse is over the container. Define cursor at game.Input.buttonModeCursor.

cache Boolean (Default: false)

Cache container content as bitmap.

children Array

(No description yet)

height Number

(No description yet)

hitArea Rectangle|Circle

(No description yet)

interactive Boolean (Default: false)

(No description yet)

mask Graphics

(No description yet)

parent Container

(No description yet)

position Vector

(No description yet)

renderable Boolean (Default: true)

(No description yet)

rotation Number (Default: 0)

(No description yet)

scale Vector

(No description yet)

skew Vector

(No description yet)

stage Container

(No description yet)

visible Boolean (Default: true)

Visibility. If set to false, rendering and interactivity will be disabled.

width Number

(No description yet)

x Number

Shorthand for position.x

y Number

Shorthand for position.y

Methods

_destroyCachedSprite()

(No description yet)

_generateCachedSprite()

(No description yet)

_getBounds() Rectangle

(No description yet)

_worldBounds

_removeStageReference()

(No description yet)

_render(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderCanvas(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderChildren(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_setStageReference(stage)

(No description yet)

Parameters:

  • stage Container
_updateChildTransform()

(No description yet)

_updateParentTransform()

(No description yet)

addChild(child)

(No description yet)

Parameters:

  • child Container
addChildAt(child, index)

(No description yet)

Parameters:

  • child Container
  • index Number
addTo(container, [index])

Add this to container.

Parameters:

  • container Container
  • index Number (optional)
anchorCenter()

(No description yet)

center(target, [offsetX], [offsetY], [worldPos])

Position container to center of target.

Parameters:

  • target Container
  • offsetX Number (optional)
  • offsetY Number (optional)
  • worldPos Boolean (optional)

    Use world position.

click(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
hitTest(target) Boolean

Test if container's bounds are overlapping target's bounds.

Parameters:

  • target Container
mousedown(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent

Return true, to skip to next object.

mousemove(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent

Return true, to skip to next object.

mouseout(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
mouseover(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
mouseup(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent

Return true, to skip to next object.

mouseupoutside(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
onScreen() Boolean

Check if container is on the screen.

Return true, if on the screen.

remove()

Remove this from it's parent.

removeAll()

Remove all childrens.

removeChild(child)

Remove children.

Parameters:

  • child Container
swap(container)

Swap container position with this container.

Parameters:

  • container Container
swapChildren(child, child2)

Swap position of two childrens.

Parameters:

  • child Container
  • child2 Container
toBottom()

Move container to first children.

toTop()

Move container to last children.

toWorldPosition([vector], [local]) Vector

Get current world position

Parameters:

  • vector Vector (optional)

    Vector to set world position

  • local Boolean (optional)

    Convert world position to local position

Returns new Vector, if vector parameter not defined

updateTransform()

(No description yet)