Created
April 9, 2018 15:38
-
-
Save codetricity/4ee87926ff940fa26fdce04d56e6b0cb to your computer and use it in GitHub Desktop.
use of forEach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
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