Jump to content

Drag Sprite inside a scaled group does not work properly


bali33
 Share

Recommended Posts

Hi guys,

 

I'm trying to drag a Sprite which is inside a group who has its scale x and y values not set to 1. The drag works but not quite correctly, as the cursor moves and get further from the orignal start drag location a gap appears between the mouse and the Sprite - if the mouse moves toward the orignal start drag location the gaps decreases.

 

The code is pretty simple :

this.rootGroup.scale.x = this.rootGroup.scale.y = 0.75  //if set to 1 no issuethis.casserolle.inputEnabled = true;this.casserolle.input.enableDrag(false);

Any idea why ? 

 

Thank you

Link to comment
Share on other sites

Ok, I found this post : http://www.html5gamedevs.com/topic/6897-how-to-drag-sprite-from-a-scaled-or-rotated-group/?hl=getlocalposition#entry43186

 

So it means that it's not possible to use "mySprite.input.enableDrag" when mySprite is inside a scaled group - I do have to manually listen for a click, mouse/touch move and then get the local coordinates ?  Actually I just look at the document and there is an event for inputDown and inputUp but nothing like "inputMove" - so what would be the best way to manually update a Sprite position while the mouse/finger is moving ?

 

Is it not possible to make "enableDrag" to automatically do this ? Seems logical that when dragging an object it has to follow the mouse.

 

Thank you

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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