Jump to content

How do I implement touch and dragging a sprite?


frozenthrone
 Share

Recommended Posts

I want to touch a sprite hold it and drag it to a new point and then release it. How do I implement this?

 

I tried the following code.

sprite.inputEnabled = true;sprite.input.start(0, true);sprite.input.enableDrag(false, true, true);

It is working perfectly using mouse on desktop but on mobile, first i have to touch the sprite then touch on another position to move the sprite there(No dragging and dropping is done here). I want to touch the sprite to pick it up and without releasing I want to drag and move it to a new position. Please help. Thanks

Link to comment
Share on other sites

I want to touch a sprite hold it and drag it to a new point and then release it. How do I implement this?

 

I tried the following code.

sprite.inputEnabled = true;sprite.input.start(0, true);sprite.input.enableDrag(false, true, true);

It is working perfectly using mouse on desktop but on mobile, first i have to touch the sprite then touch on another position to move the sprite there(No dragging and dropping is done here). I want to touch the sprite to pick it up and without releasing I want to drag and move it to a new position. Please help. Thanks

Phaser 2.0.5 working code for you situation:

o.inputEnabled = true;o.input.enableDrag(false);
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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