Huggz Posted March 7, 2015 Share Posted March 7, 2015 I'm pretty new to Phaser. I've been playing around with trying to drag a group and it's working mostly, but I'm trying to add a drag threshold so the group has to be dragged a few pixels before the actual dragging starts. To do this, I'm setting mouseDown coords in onInputDown and in mouseMove I'm trying to do some math and the numbers are just coming up all sorts of wacky. When I mouse down and move just a tiny bit, I'm coming up with numbers larger than my threshold and I didn't even move the mouse. Looking into the problem further, I put the following into my onInputDown handler and clicked once:this.mouseDown = true;this.mouseDownOrigin = new Phaser.Point(this.game.input.x, this.game.input.y); console.log(this.game.input); console.log("(" + this.game.input.x + "," + this.game.input.y + ")"); console.log(this.mouseDownOrigin); console.log(pointer);The first line, the output of this.game.input, puts the x/y coords at (65, 206).The second line, printing input x/y, puts the x/y coords at (115, 197).The third line, the point constructed from input x/y, agrees with the second line (115, 197).The fourth line, the handler pointer parameter, has x/y coords that agree with the first line (65, 209.125). I'm pretty confused at this point. Why are these x/y coords coming up different? Based on a visual of where I'm clicking, the second and third lines are the coordinates I want. My big question is why is reading game.input.x and game.input.y into a Phaser.Point is changing the values?! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts