API Docs for: 0.0.2
Show:

Atlantis.SpriteGroup Class

Extends Sprite
Module: Engine
Parent Module: Atlantis

A collection that initialize, load, update and draw _sprites.

Constructor

Atlantis.SpriteGroup

()

Methods

add

(
  • sprite
)

Add an sprite to the group.

Parameters:

  • sprite Atlantis.Sprite

    The sprite to add.

addAnimation

()

clear

()

Clear the collection.

collides

() Boolean

Returns:

Boolean:

Return true if collides otherwise return false.

collidesWithGroup

(
  • sprite
  • computeBoundingRect
)
Boolean

Parameters:

  • sprite Atlantis.Sprite
  • computeBoundingRect Boolean

Returns:

computeBoundingSize

()

Compute the bounding size of the group.

countDead

() Number

Count the number of dead sprite in the group.

Returns:

Number:

Return the number of dead sprites.

countLiving

() Number

Count the number of living sprite in the group.

Returns:

Number:

Return the number of living sprites.

draw

(
  • spriteBatch
)

Draw the sprite on screen.

Parameters:

draw

(
  • UNKNOWN
)

Draw all members on screen.

Parameters:

forEach

(
  • callback
)

Parameters:

get

(
  • index
)

Gets an sprite from the group.

Parameters:

  • index Number

    The index of the sprite on the group.

getFirstAlive

() Atlantis.Sprite

Gets the first alive sprite if available.

Returns:

Atlantis.Sprite:

Return the first alive sprite, otherwise return null.

getFirstDead

() Atlantis.Sprite

Gets the first dead sprite if available.

Returns:

Atlantis.Sprite:

Return the first killed sprite otherwise return null.

getFirstNull

() Number

Gets the first null index.

Returns:

Number:

Return the index of the first null element in the group otherwise return -1.

initialize

(
  • callback
)

Parameters:

  • callback Function

    A callback called when the sprite is fully loaded.

initialize

(
  • callback
)

Load assets of all members.

Parameters:

kill

()

Kill the sprite and put it in a cache so that it can be recycled if needed.

play

()

postUpdate

(
  • gameTime
)

Method called after the update process.

Parameters:

prepareAnimation

()

preUpdate

(
  • gameTime
)

Function called before update process.

Parameters:

preUpdate

(
  • gameTime
)

Function called before update process.

Parameters:

remove

(
  • sprite
  • splice
)

remove a sprite from the group.

Parameters:

  • sprite Atlantis.Sprite

    The sprite to remove.

  • splice Boolean

    Whether the object should be cut from the array entirely or not.

removeAt

(
  • index
  • splice
)

Remove a sprite from the group at the position.

Parameters:

  • index Number

    The index of the sprite to remove.

  • splice Boolean

    Whether the object should be cut from the array entirely or not.

revive

()

Revive the Sprite and remove it from the recycle cache.

setSize

()

update

(
  • gameTime
)

Update logic of all members.

Parameters:

update

(
  • gameTime
)

Update process.

Parameters:

Properties

active

Boolean

Active or not the sprite.

Default: true

alive

Boolean

Indicate if the sprite is alive or dead.

Default: true

height

Number

Sprite's height.

Default: 0

texture

Object

Sprite's texture.

Default: null

textureName

String

The name of the texture used by the sprite.

Default: ""

width

Number

Sprite's width.

Default: 0

x

Number

Position on X axis.

Default: 0

y

Boolean

Position on Y axis.

Default: 0