Hi,
I am working on a phaser project in where the platforms are randomly generated. I followed:
but now I'm having an issue making the platforms immovable, getting an undefined error:
platforms = game.add.group();
platforms.enableBody = true;
for(var i = 0; i < 15; i++){
createUniqueLocation();
}
platforms.sort();
function createUniqueLocation(){
do{
var x = game.math.snapTo(game.world.randomX, 32) / 32;
var y = game.math.snapTo(game.world.randomY, 32) / 32;
if(y > 750){
y = 500;
}
var idx = (y * 17) + x;
}
while(locs.indexOf(idx) !== -1);
locs.push(idx);
platforms.create(x * 32, y * 32, 'platform', game.rnd.integerInRange(0,7));
}
I saw something sort of similar where they made a function outside of the phaser canvas, whats the best way to make the platforms immovable?
Thanks