1 decade ago by Joncom
In the update function of my player.js entity I have the following code:
Here's an example output of messagebox:
It's weird because I'm standing in the middle of an open grassy field in the game. How is it possible that I can be detecting collisions nearby when I'm not near any?
var res = ig.game.collisionMap.trace( this.pos.x, this.pos.y, this.pos.x+16, this.pos.y+16, 4, 4 );
if ( res.collision.x || res.collision.y )
{
this.messagebox = "Collision found........\n" +
"\n player is @:\n " + this.pos.x + "," + this.pos.y +
"\n collision:\n " + res.pos.x + "," + res.pos.y;
}
Here's an example output of messagebox:
Collision found........
player is @:
224,192
collision:
464,255
It's weird because I'm standing in the middle of an open grassy field in the game. How is it possible that I can be detecting collisions nearby when I'm not near any?
