gsko Posted January 15, 2015 Share Posted January 15, 2015 Using this example: http://examples.phaser.io/_site/view_full.html?d=input&f=drag.js&t=drag Would there be a way to slow down the drag so it would restrict a user from dragging a Sprite around so fast? Thanks. Link to comment Share on other sites More sharing options...
gsko Posted January 15, 2015 Author Share Posted January 15, 2015 Or alternately, is there a way to slow down the input pointer so it moves slower? Link to comment Share on other sites More sharing options...
ultimatematchthree Posted January 15, 2015 Share Posted January 15, 2015 If you read through the source code which takes care of dragging sprites, you will see (correct me if I'm wrong) that there's nothing there that allows for "slow drag". If you're willing to write your own code to make this happen though, there are many ways of doing this. Here's one way: 1) Start with the accelerate to pointer example.2) Add a boolean variable, initially set to false, which will indicate whether dragging should happen or not.3) Call moveToPointer only if this boolean variable is set to true.4) Add an onDown input handler to your sprite that sets this boolean variable to true.5) Add an onUp input handler to your game (not just the sprite) that sets this boolean variable to false.6) See what happens... Link to comment Share on other sites More sharing options...
Recommended Posts