Search the Community
Showing results for tags 'out of canvas'.
-
Hey Guys! I am making a game when I need the player to look at mouse pointer. I implemented this. But Phaser seems to be giving coordinates only inside canvas bounds. which gives effect like this: demo I get mouse coordinates like this: lookAtMouse() { const mouseX = this.game.input.mousePointer.worldX, mouseY = this.game.input.mousePointer.worldY; this.lookAt( mouseX, mouseY ); } lookAt( targetX, targetY ) { const targetPoint = new Phaser.Point( targetX, targetY ), entityCenter = new Phaser.Point( this.body.x, this.body.y ); let targetAngle = ( 360 / ( 2 * Math.PI ) ) * this.game.math.angleBetweenPoints( targetPoint, entityCenter ) - 90; if ( targetAngle < 0 ) { targetAngle += 360; } this.angle = targetAngle; } Is there any way that I can get mouse coordinates outside of the canvas ?
- 2 replies
-
- out of canvas
- pointer
-
(and 3 more)
Tagged with:
-
Hello everyone! As shown in this example http://phaser.io/examples/v2/input/out-of-game-mouse-up Mose up is firing when you move your mouse with holded button out of canvas. So the question is here any ways to disable this firing? Best regards
- 5 replies
-
- mouseup
- out of canvas
-
(and 1 more)
Tagged with: