j0hnskot Posted June 6, 2014 Share Posted June 6, 2014 Hello! My problem is that the body.blocked and body.touching returns false to everything (except 'none') even when the sprite is at the top of a tile. What am i missing? Link to comment Share on other sites More sharing options...
j0hnskot Posted June 6, 2014 Author Share Posted June 6, 2014 Ok, got it. Blocked checks for collision between the sprite and a tile or the world bounds and touching checks between the sprite and an another sprite. But it only worked when i used it in a button press: if(this.cursors.up.isDown){ console.log(this.p.body.touching.down); //it outputs true here if (this.p.body.onFloor()){ this.p.body.velocity.y = -250; }}How can i get it to work with a function like this :if (this.p.body.blocked.down){ //do something}without the need to put it into an input check? Link to comment Share on other sites More sharing options...
j0hnskot Posted June 6, 2014 Author Share Posted June 6, 2014 Well, forget it. It works. I don't know what i did wrong before. Link to comment Share on other sites More sharing options...
Baron Karza Posted June 23, 2014 Share Posted June 23, 2014 Well, forget it. It works. I don't know what i did wrong before. It happened also to me.I think it was because I set gravity.y = 0Maybe you did the same, please let me know. Link to comment Share on other sites More sharing options...
j0hnskot Posted June 23, 2014 Author Share Posted June 23, 2014 I was using console.log to output the values of touching. The value changes each frame so you can't really see the values. It wasn't working wrong. I was just trying to test the values the wrong way. Link to comment Share on other sites More sharing options...
Recommended Posts