What? Posted September 29, 2014 Share Posted September 29, 2014 The documentation isn't good enough, and the topics I've searched for didn't help either. Link to comment Share on other sites More sharing options...
lewster32 Posted September 29, 2014 Share Posted September 29, 2014 This example has a demonstration on how to use it: http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=tile+callbacks.js&t=tile%20callbacks Link to comment Share on other sites More sharing options...
Lutcikaur Posted September 29, 2014 Share Posted September 29, 2014 Is there a way to after the callback, have the sprite go through the collision based on the output of the callback? Link to comment Share on other sites More sharing options...
lewster32 Posted September 29, 2014 Share Posted September 29, 2014 You'd normally do this with processCallback: http://examples.phaser.io/_site/view_full.html?d=arcade%20physics&f=process+callback.js&t=process%20callback Link to comment Share on other sites More sharing options...
What? Posted October 8, 2014 Author Share Posted October 8, 2014 It's not working. Is it possible to make a tile kill the player when they touch it, for example? here's my code:var loderunner = loderunner || {};loderunner.Game = function(){};loderunner.Game.prototype.preload = function(){ this.game.time.advancedTiming = true; this.game.physics.startSystem(Phaser.Physics.ARCADE); this.load.spritesheet('dude', 'assets/dude.png', 64, 64); this.load.tilemap('level', 'assets/templevel.json', null, Phaser.Tilemap.TILED_JSON); this.load.image('tiles', 'assets/temptiles.png');};loderunner.Game.prototype.create = function(){ this.map = this.game.add.tilemap('level'); this.map.setTileIndexCallback(0, this.haha, this); this.map.addTilesetImage('temptiles', 'tiles'); this.blockedLayer = this.map.createLayer('blockedLayer'); this.map.setCollisionBetween(1, 1000, true, 'blockedLayer'); this.blockedLayer.resizeWorld(); //add some input this.cursor = this.game.input.keyboard.createCursorKeys(); this.playerState = 0; // 0 = grounded // 1 = climbing // 2 = hanging // 3 = edge-hanging // 4 = falling // 5 = crouching //add the dude and enable physics on him this.player = this.game.add.sprite(400, 300, 'dude'); this.game.physics.arcade.enable(this.player); this.player.body.collideWorldBounds = true; this.player.body.gravity.y = 1000; //adjust the player's anchor this.player.anchor.setTo(0.25, 0.25); //scale and offset the player's hitbox this.player.body.setSize(24, 30, -6, -6) this.player.smoothed = false; // some info about the player animations: // 24 fps is the standard // 'run' is 16 frames long this.player.animations.add('idle', [0], 0, true); this.player.animations.add('idle_action', [0,1], 24, true); this.player.animations.add('run', [28,29,30,31,32,33,34,35,36,37,38,39,24,25,26,27], 24, true); this.player.animations.add('push', [40,41,42,43,44,45,46,47], 24, true);};loderunner.Game.prototype.haha = function(){ this.player.kill();};loderunner.Game.prototype.update = function(){ this.game.physics.arcade.collide(this.player, this.blockedLayer); }; Link to comment Share on other sites More sharing options...
Recommended Posts