zajca Posted August 24, 2015 Share Posted August 24, 2015 I want on collision calculate positions of player and items that collides and evaluate if items is in certain bounds in relation to player. But I'm not sure what is real position of body, not sprite image. I was going through documentation and objects and found these coordinates:player.x,player.sprite.x,player.sprite.body.x,player.data.position[0],player.data.position[1],player.sprite.position.x,player.sprite._bounds.x,player.sprite._bounds.left,player.sprite._bounds.right,player.sprite._bounds.widthbut the values doesn't make sense to me:133.02244186401367133133.02244186401367-6.651122093200684-40.4560775756835941330000player has dimensions 296x135pxand body starts ~18px from sprite left side and ends ~40px from right side.anchor is set to 0,0 x looks like center of body (sprite was moved almost to border) 296-58 = 238/2 = 119 + 18 = 137 also in 2.4 _bounds are not calculated and I'm getting 0 all the time. how can I calculate x position on start of body and end of body, to be able detect if collision like on the picture? //EDIT: also items are rotating and colliding, so I need real x body position. Link to comment Share on other sites More sharing options...
Recommended Posts