Phaser API Documentation

  Version: 
incData(key, [amount])

Description:

Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0.

If the Game Object has not been enabled for data (via setDataEnabled) then it will be enabled before setting the value.

If the key doesn't already exist in the Data Manager then it is created.

When the value is first set, a setdata event is emitted from this Game Object.

Parameters:

name type arguments Default description
key string

The key to change the value for.

amount number <optional> 1

The amount to increase the given key by. Pass a negative value to decrease the key.

Returns:
Description:

This GameObject.

Since: 3.23.0