rhennig Posted May 7, 2017 Share Posted May 7, 2017 Hello! I'm having some troubles trying to change the priority of mouse clicks. First I set: this.input.onDown.add(function(){alert("world");}, this); To catch mouse clicks on my entire game window and this works fine. But sometimes I create sprites and I want them to have different mouse clicks events. For this I use: this.spritetest.events.onInputDown.add(function(){alert("sprite");}, this,100); My goal is to give priority to the sprite event function if clicked on a sprite and fire the "general function" if not. But the "general function" ever fires first! I tried to set the priority parameter as you can see on the second function but this doesn't seem to change anything in my case. Can someone points me how I can fix this? Thanks! Link to comment Share on other sites More sharing options...
samme Posted May 7, 2017 Share Posted May 7, 2017 I think the priority parameter orders callbacks on the same signal only. You might try putting the "general" click handler on a background sprite instead. rhennig 1 Link to comment Share on other sites More sharing options...
rhennig Posted May 7, 2017 Author Share Posted May 7, 2017 Ok, I have a tilemap as background and putting the click handler on the layer fixed my problem. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts