clark Posted February 18, 2015 Share Posted February 18, 2015 I have just an image that follows the mouse basically and at the end of the process I forgot that touch devices do not always generate mouseMoves. MouseMoves only happen when the pointer is active. I am sure there is logic in there and a re-write. However! Just checking, is there any way to do this?if (this is not a mouse){ //remove from display list}Thanks! Link to comment Share on other sites More sharing options...
mxmlb Posted February 18, 2015 Share Posted February 18, 2015 Hi, You could just check game.device.desktop or game.device.touch.http://docs.phaser.io/Phaser.Device.html clark 1 Link to comment Share on other sites More sharing options...
in mono Posted February 18, 2015 Share Posted February 18, 2015 Phaser.Pointer should do the job, it has a 'isMouse' property. You need to pass the pointer as a parameter to the event you're subscribing to, then you can do the check like this:if (!pointer.isMouse) { // Your code goes here} Link to comment Share on other sites More sharing options...
clark Posted February 18, 2015 Author Share Posted February 18, 2015 Man I was looking on the Phaser.Input class! This will suit perfectly for my needs thanks. Just one question though as it will bug me. What happens in the case of a Microsoft Surface for example? Where I guess there could be a mouse plugged in or a touch screen? Maybe this is a question by itself but throwing it out there before marking it solved. Not sure if these are desktops or not and I guess support touch but also could have a mouse too. Link to comment Share on other sites More sharing options...
mxmlb Posted February 18, 2015 Share Posted February 18, 2015 I think it would be detected as touch and not desktop from what I understand of the initialization :http://docs.phaser.io/Device.js.html#sunlight-1-line-560 clark 1 Link to comment Share on other sites More sharing options...
Recommended Posts