Retrieves the value for the given key in this Game Objects Data Manager, 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:
Or access the value directly:
You can also pass in an array of keys, in which case an array of values will be returned:
sprite.getData([ 'gold', 'armor', 'health' ]);
This approach is useful for destructuring arrays in ES6.
|key||string | Array.<string>||
The key of the value to retrieve, or an array of keys.
The value belonging to the given key, or an array of values, the order of which will match the input array.