dancramp Posted July 28, 2015 Share Posted July 28, 2015 Hi, I'm trying to implement the new virtual joystick and want to use the show on touch version so that the stick only appears/is activated on the left side of the screen leaving the right side for a fire/jump button or similar. I may be being a bit dumb, but can't work out how to do this. When pressing a button it activates both the fire/jump and the directional (and show's the joystick underneath). Any advice gratefully received! Thanks. Link to comment Share on other sites More sharing options...
rich Posted July 28, 2015 Share Posted July 28, 2015 There's no "native" way to do this, but you could override the 'onDown' handler with something like this:stick = pad.addStick(0, 0, 200, 'arcade');stick.showOnTouch = true;// remove default handlerstick.pad.game.input.onDown.remove(stick.checkDown, stick);// add in your owngame.input.onDown.add(checkDown, this);function checkDown(pointer) { if (pointer.x < game.width / 2) { // right place? then call the Sticks checkDown method stick.checkDown(pointer); }} jdnichollsc 1 Link to comment Share on other sites More sharing options...
dancramp Posted July 28, 2015 Author Share Posted July 28, 2015 Hi Rich, Thanks for the quick reply and great stuff - works perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts