Schludi Posted June 11, 2015 Share Posted June 11, 2015 Hello! As-is Situation:I have a world with more width than the game has, because the camera should follow a sprite that is draggable by mouse and can be thrown through the world. https://phaser-schludi.c9.io/beer-througher/beerThrougher.1.html My problem: When the camera follows the sprite, the game.input.mousePointer has not the offset of the camera, so that i cannot grab the sprite when it is on the right side.function mouseDragStart() { game.physics.box2d.mouseDragStart(game.input.mousePointer); startX=Math.round(sprite.x); startY=Math.round(sprite.y); headline.text='Start Point: (' + startX + ','+ startY +')';}function mouseDragMove() { game.physics.box2d.mouseDragMove(game.input.mousePointer);}Question:How can i add the offset to the mouse pointer that i can grab the sprite when it is on the right side? Link to comment Share on other sites More sharing options...
Schludi Posted June 11, 2015 Author Share Posted June 11, 2015 When i assign the mousePointers worldX to x it works... but i don't know if this is the solution?function mouseDragMove() { // When not adding this two lines, the camera offset is not dragged // when the beer is on the right side game.input.mousePointer.x=game.input.mousePointer.worldX; game.input.mousePointer.y=game.input.mousePointer.worldY; game.physics.box2d.mouseDragMove(game.input.mousePointer);} Link to comment Share on other sites More sharing options...
timinman Posted August 6, 2015 Share Posted August 6, 2015 Thanks for posting the solution! I was having a similar issue. Link to comment Share on other sites More sharing options...
Recommended Posts