Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2014 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d67ba81f26274402736c to your computer and use it in GitHub Desktop.
Save anonymous/d67ba81f26274402736c to your computer and use it in GitHub Desktop.
Lava.prototype = {
create: function() {
this.player = this.game.add.sprite(215, 941, 'hero');
this.game.physics.startSystem(Phaser.Physics.P2JS);
this.game.physics.p2.gravity.y = 1200;
var LAVA_TILE = 245;
var FLOOR_TILE = 2;
this.map = this.game.add.tilemap('lava');
this.map.addTilesetImage('tiles');
this.map.setTileIndexCallback(LAVA_TILE, this.burn, this);
this.map.setCollision(FLOOR_TILE);
this.player = this.game.add.sprite(21, 210, 'hero');
this.game.physics.p2.enable(this.player);
this.game.physics.p2.convertTilemap(this.map, this.layer);
this.layer = this.map.createLayer('Tile Layer 1');
this.layer.resizeWorld();
},
burn: function() {
console.log('burninate');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment