tomdanvers Posted January 13, 2015 Share Posted January 13, 2015 Hi,I'm having an issue with a game ui I'm working on. I set up a number of sprites as buttons for a UI. They sit to the left of the screen and have event listeners associated with their onInputUp signals which fire correctly. Later in the user journey I create another sprite that sits below these interactive sprites and takes up the full size of the screen. This new sprite is also interactive (event listeners associated with both onInputUp and onInputDown fire correctly). HOWEVER, the new sprite blocks input events for the original sprites event though it visually sits below the full screen sprite. Does anyone have any idea what I'm doing wrong? I'm guessing I'm missing something vital about the way Phaser handles z-index and inputs? Interestingly if I .destroy() the full screen sprite the original sprites still remain unresponsive... weird! Thanks in advance! Link to comment Share on other sites More sharing options...
rich Posted January 13, 2015 Share Posted January 13, 2015 Look at the priorityID value: http://examples.phaser.io/_site/view_full.html?d=input&f=input+priority.js&t=input%20priority tomdanvers and clark 2 Link to comment Share on other sites More sharing options...
clark Posted January 13, 2015 Share Posted January 13, 2015 Awesome how just browsing the forum teaches you stuff! Link to comment Share on other sites More sharing options...
tomdanvers Posted January 14, 2015 Author Share Posted January 14, 2015 Hi Rich,Thanks for the answer, I really appreciate it. It ended up that I was doing something stupid.I needed to store the position of a pointer object over time (to achieve a line drawing affect), I foolishly overwrote the .move function of the pointer object in the hope that I'd effectively get 'move' events. It worked but in the process all the Phaser code that fired 'on move' was wiped which caused all kinds of chaos I changed the object to check the pointer position in the update() method of the sprite in question and low and it worked.Thanks,Tom Link to comment Share on other sites More sharing options...
rich Posted January 14, 2015 Share Posted January 14, 2015 If doing an art package style thing then I would suggest using Input.addMoveCallback to get a smoother result than polling pointer coordinates in an update. Also the Input manager has a coordinate history feature built in btw (Input.recordPointerHistory) but I wouldn't use this for a drawing app personally. quiphop 1 Link to comment Share on other sites More sharing options...
Recommended Posts