How do you use TouchScreenButtons as a mobile dpad?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sumguy05

Hi all,

My question is essentially 2 fold.

  1. What format of image does this node accept? I tried uploading a .png and it wouldn’t allow me to.

  2. More importantly how do i get the buttons to control the player? The movement/control script are in the player scene.

:bust_in_silhouette: Reply From: Xiuhman

If you are using the “ui_right”, “ui_left” and “ui_up” for your movement, you could use those for your buttons.

Go to your Button and in the “TouchScreenButton” class you can find the “Action” property, there all you have to do is type the “ui” correspondent for the button.

Not sure if it can only be done with the “ui” but it worked for me.

Hope it’s helpful.

Thank you so much i will try it when i get home to work on it. Can you upload a .png file for a TouchScreenButton if not what would be the best format to upload a button icon?

sumguy05 | 2018-12-04 19:47

As for the images I’m unaware of the issue, all my TouchScreenButtons have .png files and work just fine.

Did it specify an error?

Xiuhman | 2018-12-04 20:39

It Says “Error loading file: Not a Resource!” What is your process for using the .png? The load option or code? I’m trying to load a Normal and a Pressed button and neither will upload.

sumguy05 | 2018-12-04 23:38

Maybe try reimporting it.

And I use the load option, I don’t use any code for the sprites.

Xiuhman | 2018-12-05 00:00

Reloading worked. It was an issue with the images themselves. Thanks for your help.

sumguy05 | 2018-12-05 05:05