J4G Posted June 20, 2015 Report Share Posted June 20, 2015 I'm creating a game where, by necessity, each of my tiles exists as a sprite within a group. They all use P2 Physics for collisions. I'm careful to set each sprite to static, and then configure them like so this.sprite.body.setRectangle(TILE_WIDTH, TILE_HEIGHT) this.sprite.body.static = true; this.sprite.body.x = this.x * TILE_WIDTH + (TILE_WIDTH / 2); this.sprite.body.y = this.y * TILE_HEIGHT + (TILE_HEIGHT / 2); But the locations of the bodies are ever so slightly off, usually by around .0000001, and it looks like this error is applied on every update cycle in spite of my efforts. Now you wouldn't think such a minor change would affect things, but it actually leads to rounding errors causing vertical black lines between tiles. Is this a bug, or are there changes I can make to my code to resolve this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.