loover Posted September 13, 2016 Share Posted September 13, 2016 How to add click (not mouseDown) event handler to Sprite? "Click" mean "press mouse on sprite and release mouse on sprite". E.g. as click in desktop OS or tap on mobiles. Link to comment Share on other sites More sharing options...
douglas Posted September 13, 2016 Share Posted September 13, 2016 this kind of script should go to a jsfiddle, i don't have it for the moment because of an ssl issue, if i find the issue i'll probably share some code with it Link to comment Share on other sites More sharing options...
samme Posted September 13, 2016 Share Posted September 13, 2016 http://phaser.io/docs/2.6.2/Phaser.Events.html#onInputUp Link to comment Share on other sites More sharing options...
douglas Posted September 13, 2016 Share Posted September 13, 2016 I have fixed in some way the problem of the ssl connexion, but there is an error https://jsfiddle.net/johndo101/gv36y3q0/ run and tape f12 Link to comment Share on other sites More sharing options...
douglas Posted September 13, 2016 Share Posted September 13, 2016 it works now https://jsfiddle.net/johndo101/xmuna230/ yey Link to comment Share on other sites More sharing options...
loover Posted September 14, 2016 Author Share Posted September 14, 2016 samme Ok. In 2.2.2 it works in different way. And in 2.6.2 too. If you press on sprite and move cursor out (with pressed mouse) and then release mouse - this events fired. But real "click" works only mouse down and mouse press happens on the same object. Link to comment Share on other sites More sharing options...
samme Posted September 14, 2016 Share Posted September 14, 2016 You can use the third argument to the callback: Quote {boolean} isOver - Is the Pointer still over the Game Object? Link to comment Share on other sites More sharing options...
loover Posted September 14, 2016 Author Share Posted September 14, 2016 Ok, thanks. Link to comment Share on other sites More sharing options...
Recommended Posts