Jump to content

VirtualJoystick + touch


Recommended Posts

Hi all, 
I'm new to Phaser and I'm developing my first game.
I've tried different virtual joysticks and also tried to develop my own but I'll be always stuck on the same problem: have multitouch interaction during joystick movement.
I'll detail my problem for better understand.
I've bought the official Phaser Virtual Joystick Plugin and using it to move the player around the screen. I'm using the plugin with the showOnTouch option enabled because the game is designed for mobile devices.
Now I want to let the player jump in two cases:

  • while the user is dragging the joystick
  • when the user just tap on the screen.

To face this challenge I've tryed different solutions, but none of them is working properly. Theese is what I've tryed:

  • Using the Virtual Joystick's button: it's not the final solution because the button is stuck on the screen, and I don't want that. I've also have some strange issue with this solution, the button disappear when I deploy the app for Android mobile (I've didn't test it on iOs)
  • Interacting directly with the InputManager
    this.game.input.activePointer OR this.game.input.pointer1
  • Using a big transparent sprite and bind a touch event on it (I don't know how to do this)

Can you point me in the right direction to let my little dude to jump?
I know this is a noob question, but I'm really stuck on this problem from a while. I've already coded the main parts of the game and now I really need to make it work.
Thank you in advance

All the best
-- UPDATE --
ok, I've debugged and tested a little bit more and the "disappearing button" issue was due to Intel XDK's debug. I've deployed the game for Crosswalk and now the button appears correctly, as you can see here:







What I want is that the white part here is the button area where the user can tap to jump. The white area is on the right because the joystick is on the left, otherwise the white area will be on the left.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...