Class: Group

Group()

A Group stores a collection of Sprites.

Constructor

new Group()

Initializes a list to store Sprites.
Source:

Methods

addSprite(sprite)

Add a sprite to this group.
Parameters:
Name Type Description
sprite Sprite a sprite to add to this group
Source:

drawSprites(context)

Draw the sprites in this group.
Parameters:
Name Type Description
context the graphics context object associated to the game canvas
Source:

getSpriteCount() → {number}

Get the number of sprites in this group.
Source:
Returns:
the number of sprites in this group
Type
number

getSpriteList() → {List}

Get the list of sprites stored in this group.
Typically used in loops that involve all sprites in this group.
Source:
Returns:
the list of sprites in this group
Type
List

removeSprite(sprite)

Remove a sprite from this group.
Parameters:
Name Type Description
sprite Sprite a sprite to remove from this group
Source:

updateSprites(deltaTime)

Update the sprites in this group.
Parameters:
Name Type Description
deltaTime the change in time since the last clock update
Source: