Skip to content

Instantly share code, notes, and snippets.

@codetricity
Created April 9, 2018 15:38
Show Gist options
  • Save codetricity/4ee87926ff940fa26fdce04d56e6b0cb to your computer and use it in GitHub Desktop.
Save codetricity/4ee87926ff940fa26fdce04d56e6b0cb to your computer and use it in GitHub Desktop.
use of forEach
/***
create: function(){
var platformData = [
{"x": 0, "y": 430},
{"x": 45, "y": 560},
{"x": 90, "y": 290},
{"x": 0, "y": 140}
];
this.platforms = this.add.group();
this.platforms.enableBody = true;
this.platformData.forEach(function(element){
this.platforms.create(element.x, element.y, 'platform');
}, this);
***/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment