DWboutin Posted February 19, 2014 Share Posted February 19, 2014 Hi, I just changed from 1.1.2 to 1.1.4 and i can't detect to collision side of my sprite.define("Play", ['Game', 'Holoboy'], function(Game, Holoboy) { var Play = function (){ this.game = Game; this.holoboy; this.map; this.layer; }; Play.prototype = { preload: function(){ this.game.add.sprite(0, 0, 'preloaderBackground'); }, create: function(){ this.holoboy = new Holoboy(0,0); this.map = this.game.add.tilemap('map'); this.map.addTilesetImage('tiles'); this.map.setCollisionBetween(2, 12); this.layer = this.map.createLayer('Calque de Tile 1'); }, update: function(){ this.holoboy.move(); this.game.physics.collide(this.holoboy.sprite, this.layer); console.log(this.holoboy.sprite.body.touching); } } return Play; });My console.log(this.holoboy.sprite.body.touching); always alert me Object {none: true, up: false, down: false, left: false, right: false…} My holoboy object : http://pastebin.com/UzpkihfwMy controllable object : http://pastebin.com/FcEWkWS8 The collision works well by the way. My character can jump on the tiles and he is stopped by them.What's wrong with my code? Thank you Link to comment Share on other sites More sharing options...
ghostrifle Posted March 2, 2014 Share Posted March 2, 2014 I have the same problem. Did you solve your problem ? Link to comment Share on other sites More sharing options...
Heppell08 Posted March 2, 2014 Share Posted March 2, 2014 Var player;Then to detect it:Player.body.blocked.upPlayer.body.blocked.left etc etc.That detects the sides all around the player. ghostrifle, DWboutin and ekiscrim 3 Link to comment Share on other sites More sharing options...
ghostrifle Posted March 3, 2014 Share Posted March 3, 2014 Thank you Heppel08!!!!! This seems to work ! Heppell08 1 Link to comment Share on other sites More sharing options...
DWboutin Posted March 4, 2014 Author Share Posted March 4, 2014 AWESOME Heppell08 !!! You rock ^^ Link to comment Share on other sites More sharing options...
Recommended Posts