Phaser API Documentation

  Version: 
count(property, value, [startIndex], [endIndex])

Description:

Returns the total number of Game Objects in this Container that have a property matching the given value.

For example: count('visible', true) would count all the elements that have their visible property set.

You can optionally limit the operation to the startIndex - endIndex range.

Parameters:

name type arguments Default description
property string

The property to check.

value any

The value to check.

startIndex number <optional> 0

An optional start index to search from.

endIndex number <optional> Container.length

An optional end index to search up to (but not included)

Returns:
Description:

The total number of Game Objects in this Container with a property matching the given value.

Type:
  • number
Examples:
Since: 3.4.0