RogueBurger Posted January 9, 2014 Share Posted January 9, 2014 I've just been diving into the framework for the first time today, and having a blast; however I have run into a snag that I can't seem to find the answer to. I have a sprite and I successfully enabled dragging on it with ( mySprite.inputEnabled = true; mySprite.input.enableDrag(); ), however when I drag it around it falls behind the cursor, and then "rubber bands" back to the cursor's location when I stop moving it. Is there any way to stop this from happening, and instead have the sprite stick to exactly where the cursor is? Link to comment Share on other sites More sharing options...
drobbo Posted January 23, 2014 Share Posted January 23, 2014 here's a fix for that: sprite.inputEnabled = true;sprite.input.enableDrag(false);sprite.events.onDragStart.add(function(){ arguments[0].body.gravity.y = 0; arguments[0].body.gravity.x = 0; },this);sprite.events.onDragStop.add(function(){ arguments[0].body.gravity.y = GRAVITY_Y; arguments[0].body.gravity.x = GRAVITY_X; },this); with GRAVITY_X and GRAVITY_Y being your values you set to that certain Link to comment Share on other sites More sharing options...
Recommended Posts