Phaser API Documentation

  Version: 
get(key)

Description:

Retrieves the value for the given key, or undefined if it doesn't exist.

You can also access values via the values object. For example, if you had a key called gold you can do either:

this.data.get('gold');

Or access the value directly:

this.data.values.gold;

You can also pass in an array of keys, in which case an array of values will be returned:

this.data.get([ 'gold', 'armor', 'health' ]);

This approach is useful for destructuring arrays in ES6.

Parameters:

name type description
key string | Array.<string>

The key of the value to retrieve, or an array of keys.

Returns:
Description:

The value belonging to the given key, or an array of values, the order of which will match the input array.

Type:
  • *
Inherited from: Phaser.Data.DataManager#get
Since: 3.0.0
Source: src/data/DataManager.js (Line 116)