Jump to content

Mobile touch support


brz0
 Share

Recommended Posts

Can someone please explain/show me what code I need to insert to add mobile touch support to a game in phaser. I am trying to build onto the invaders example: 

 

http://examples.phaser.io/_site/view_full.html?d=games&f=invaders.js&t=invaders

 

I need more specifically a button for keyboard left, a button for space bar, and a button for keyboard right on mobile.

 

Also I have read the docs and I am fairly new to this, so I'm having a hard time deciphering what the docs are even talking about on pages like keyboard events, Phaser.key etc. If someone could please show me an actual example of how to do this, and not just tell me to read the docs it would be greatly appreciated.

Link to comment
Share on other sites

  • 8 months later...

The Virtual Game Controller example in the Input section uses buttons. I am not sure it is still in the list for v. 2.4.4. There are also other examples of virtual joysticks. There is link to a course on making mobile games with Phased. The course is not free.

In the pre load stage you add button pictures. In the create ection you add some variables and code for the buttons. In the render section you put code that shows what happens when a button is pressed.

It was pretty easy to get this working for Tanks but I have a conflict with the active pointer so when I tap a button, the turret turns toward the button pressed. That's why I am interested in your post and replies to it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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