Mobile stuffs


Ok, mobile support wasn’t bad at all.

  1. On the itch.io upload page check Mobile Friendly. I picked orientation “Portrait”.
  2. Fix scaling with Project Settings -> Stretch mode -> 2D. I chose to ignore the aspect ratio since my vector graphics won’t look too bad a little stretched.
  3. In Godot Project Settings -> Input Devices -> Pointing -> Emulate touch from mouse. That allows me to test touch support on my desktop, using the mouse.
  4. Add TouchScreenButton nodes (there’s a node for everything) and child nodes for shapes. In my case I use some polygons and lines with transparency set to 50% to draw the buttons.
  5. Link up the pressed/released signals to some script.
  6. In each of those handlers call the appropriate Input.action_press([action]) or Input.action_release([action]) functions.

And that was it. The rest of my code is already checking for those actions so that it can respond to the keyboard.

Files

spacejam.zip Play in browser
Sep 04, 2021

Leave a comment

Log in with itch.io to leave a comment.