Search the Community
Showing results for tags 'ondragstart'.
-
I was wondering if there are some examples of adding onDragStart and onDragStop events dynamically once a condition is met? The picture shows the asked functionality: I press "The Horizontal baffle" button, and by doing that, a horizontal handle is added on screen following the mouse cursor. Currently the handle is moved directly with (x, y) coordinates on update, so no drag events included. I should be able to start dragging my handle and when I stop drag or release the handle it should add new shelve. Currently I am checking gameObject.input.mousePointer.isDown state and add shelve when mouse is released. But this is just not enough. Are there some examples of this complete functionality. I am just tired of hacking and trying non-sense solutions
- 1 reply
-
- phaser 2.6.1
- onsdragstop
-
(and 1 more)
Tagged with:
-
So I have two event listeners in my game which work great drop.events.onDragStart.add(this.onDragStart, this); drop.events.onDragStop.add(this.onDragStop, this); But the callback only gets trigggered when the click takes place over the sprite. I want the event to trigger if the pointer is already down and then it moves over the sprite, is there any way to do that? One solution would be to use onInputOver drop.events.onInputOver.add(this.onInputOver, this); But that won't tell the sprite to be dragged, Is there a way to manually trigger events in Phaser? EDIT Ok I found a solution that works use onInputOver and manually start the drag. onInputOver: function(sprite, pointer){ if(pointer.isDown){ sprite.input.startDrag(pointer); } },
-
- ondragstop
- input
-
(and 4 more)
Tagged with: