Jump to content

Slow drag on Sprite


Recommended Posts

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


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...