Virtual game pad example

I have a question about virtual game pad from @britzl public examples: why (on the build on Android) when the touch is released, the joystick don’t get back to the center? On Windows it works like that. How can I debug it?

Hm, not sure, but it seems like this piece of code isn’t running as expected:

I’d add some print statements or set a breakpoint and inspect the state when touch.released is true.

I also suspected touch.released. Though, I haven’t any idea on how can I debug it on mobile. Do you use some logs or is there more convenient way? I mean debugging apk’s not builds on a remote dmengine. The joystick goes back to the center when I touch on “A” button only.

You can either use print("Hello")from your code, and watch it in your terminal window using adb logcat.

Edit: Here’s a handy tool for this: android_deploy.sh

Or, you can set the text to a gui label, so you see the message on screen.

2 Likes

1.a. Build a debug version of your game and install it and launch it
1.b. Or download dmengine.apk from d.defold.com and launch it
2. Once you have this running on the same wifi as your computer your device will show up in the Project->Target menu
3. Select your device in the list
4. Set some breakpoint(s)
5. Chose Debug->Run with debugger
6. print() statements will show up in the Console and you’ll be able to hit breakpoints and step through your code from the editor.

4 Likes

Thank you for your ideas, I’ll try them :wink:

1 Like