Multiple inputs (mobile)


Hello all,
I hope that everyone is staying safe and healthy.

I have finally gotten around to enrolling in the Apple Developer’s program and I have began mobile testing. One issue that I have run into is that I cannot input two separate inputs, for example jump and move left. It only takes the first provided input. How can I make it so that both inputs can be taken at the same time?

I am using platypus for this if that information is helpful.

This does not replicate itself when I am testing on the computer as normal.

Please let me know if you need more detail provided.

Stay healthy!



Hi, you want to set up a multi touch trigger in your input bindings and read the list of touch points.

To help you deal with multi touch you can have a look at the Defold-Input library:



Thanks for the resources! I will try to work around this, but the defold-input dependency is not being fetched for some reason.
Besides that I should be able to fix the other issues!



What did you add to game.project? Do you get any kind of indication at all? Do you have some other dependencies?



I pasted the provided link ( into the library dependencies spot. The other dependency I have is orthographic. After trying again, I was able to fetch a dependency named “in” as named in the assets viewer. This does not have as many specific items from the defold-input project itself. Is the “in” dependency all I will need?



A new issue has occurred. I am now able to get most of the input issues to work but now when I try to bundle it to ios I get an error telling me "conflicting output resource ‘build/default/in/bindings/all.input_bindingc’ generated by the following input files: [in/bindings/all.input_binding] <-> [in/bindings/all.input_binding]"



The in folder is the root folder of the Defold-Input library. Inside you’ll find all of the modules and scripts.

Not sure what is going on there. Have you copied any files or folders somehow? I would suggest that you open a file browser (Finder on macOS or Windows Explorer on Windows) and take a look in your project folder. Delete .internal and .build. Then do Project->Fetch Libraries and then try to bundle again.



Ok, I might just be looking in the wrong place, do you know where I can find these specific files?

Thanks again



The folders could be hidden.

Create a new empty project and add the Defold input library as a dependency. Fetch libraries and then build. Does that work?



Thanks, by doing this I realized something was definitely not right. Somehow two different releases of the input library was put into the library, and I did not notice they were different until I looked at the blank project! Silly mistake, thanks for all your help!

Besides that, the multi touch still does not seem to be working. I have the game set up so that it has two buttons, each when pressed will sent a message to the platypus script to move the character. I also have gestures set up to that when the player taps the screen the character jumps. I still cannot simultaneously run and jump…



Can you share your input bindings?

Can you try the example project?



When I tried the multi-touch on the example project on my phone it seemed to work fine, but when I tried it with my game it didn’t seem to work…
I have the game set up so that it has two buttons, each when pressed will send a message to the platypus script to move the character. I also have gestures set up to that when the player taps the screen the character jumps. Alone each button and the gestures work fine, but while trying to jump while moving, this does not work.
Here are my bindings:

Thanks again!



It’s hard to say what is wrong. I think you need to share some minimal example project so that we can take a look.

Why do you have two muse triggers btw? Is that left and right mouse button? You don’t need to bind two buttons. The left button (or button 1) will translate into touch events on mobile.



Haha, the reason I have them binded like that is because I sometimes interchange the two so I thought binding them that way would prevent any hiccups in case I slipped up later. :sweat_smile:

Here is the project so far: it works fine when I normally build it, the issue arrises when I build it to ios.
adventure game - (6.9 MB)
Thanks for all your help!



Well it is not surprising that it doesn’t work, because you are not implementing multi-touch like in the example project. The mobile controls.gui_script only listens for single touch input (ie click). It doesn’t bother with the multi_touch binding and iterating over the touch input table.

I see that you require the “defold-input” library but you do not use it to handle multi-touch. There is a Lua module called onscreen.lua. It simplifies the creation of on-screen controls since it handles the entire process of juggling touch points and dealing with input state on buttons or analog sticks. Check the example to learn how to use it:

1 Like


Alright that all makes sense!
Would it still work if I am not using the analog feature?
Thank you so much again for your help!




Yes, you define the buttons and input you need. If you only need buttons then only define buttons and ignore analog.



Ok so I tried to make it so that when I click a button it simply runs prints to the console telling me that it has been clicked. This print line is found in the local function on_control_a in the gui script.
I have the buttons and scrips all named and set up the same as the example project. Not sure what is going on here.

adventure game - Copy (4.0 MB)

Here is everything as of right now if you would like to take a look.
Sorry for being such a bother, thanks again!



There is an error in the console when you run the project (didn’t you see it?):

ERROR:SCRIPT: /onscreen.gui_script:36: No such node: analog
stack traceback:
	[C]: in function 'get_node'
	/onscreen.gui_script:36: in function </onscreen.gui_script:27>

On line 36 you do:

onscreen.register_analog(gui.get_node("analog"), { radius = 80 }, on_analog)

There is no node named “analog” and since an error is generated the rest of the lines in that script will not run. Add the node or remove the line and it will all work.

1 Like


Ah there we go, much thanks.
I am still at a novice level in the world of code and Defold, forgive me for the silly mistakes. What is the best way to learn so I can reduce the amount of mistakes that I make?
Is it alright for me to reach out as often as I am now?