Atlantis.SpriteGroup Class
A collection that initialize, load, update and draw _sprites.
Constructor
Atlantis.SpriteGroup
()
Item Index
Methods
Methods
add
-
sprite
Add an sprite to the group.
Parameters:
-
sprite
Atlantis.SpriteThe sprite to add.
addAnimation
()
clear
()
Clear the collection.
collidesWithGroup
-
sprite
-
computeBoundingRect
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:
Return the number of dead sprites.
countLiving
()
Number
Count the number of living sprite in the group.
Returns:
Return the number of living sprites.
get
-
index
Gets an sprite from the group.
Parameters:
-
index
NumberThe index of the sprite on the group.
getFirstAlive
()
Atlantis.Sprite
Gets the first alive sprite if available.
Returns:
Return the first alive sprite, otherwise return null.
getFirstDead
()
Atlantis.Sprite
Gets the first dead sprite if available.
Returns:
Return the first killed sprite otherwise return null.
getFirstNull
()
Number
Gets the first null index.
Returns:
Return the index of the first null element in the group otherwise return -1.
initialize
-
callback
Parameters:
-
callback
FunctionA callback called when the sprite is fully loaded.
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:
-
gameTime
Atlantis.GameTime
prepareAnimation
()
preUpdate
-
gameTime
Function called before update process.
Parameters:
-
gameTime
Atlantis.GameTime
preUpdate
-
gameTime
Function called before update process.
Parameters:
-
gameTime
Atlantis.GameTime
remove
-
sprite
-
splice
remove a sprite from the group.
Parameters:
-
sprite
Atlantis.SpriteThe sprite to remove.
-
splice
BooleanWhether the object should be cut from the array entirely or not.
removeAt
-
index
-
splice
Remove a sprite from the group at the position.
revive
()
Revive the Sprite and remove it from the recycle cache.
setSize
()
update
-
gameTime
Update logic of all members.
Parameters:
-
gameTime
Atlantis.GameTimeAn instance of GameTime.