# Multiple inputs (mobile)

**URL:** <https://forum.defold.com/t/multiple-inputs-mobile/64688>\
**Category:** Questions\
**Created:** [March 24, 2020, 2:39am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688 "2020-03-24T02:39:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 24, 2020, 2:39am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/1 "2020-03-24T02:39:34Z")

</div>

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!  
V

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 24, 2020, 5:35am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/2 "2020-03-24T05:35:59Z")

</div>

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

> **[Trigger types - Device input in Defold](https://defold.com/manuals/input/#trigger-types)**
>
> All user input is captured by the engine and dispatched as actions to script- and GUI script components in game objects that have acquired input focus and that implement the on\_input() function. This manual explains how you set up bindings to capture...

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

[https://github.com/britzl/defold-input](https://github.com/britzl/defold-input)

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 24, 2020, 7:22pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/3 "2020-03-24T19:22:19Z")

</div>

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!  
Best,  
V

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 24, 2020, 7:56pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/4 "2020-03-24T19:56:58Z")

</div>

> [@Vgreen](#):
>
> the defold-input dependency is not being fetched for some reason.

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

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 24, 2020, 8:01pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/5 "2020-03-24T20:01:52Z")

</div>

I pasted the provided link ([https://github.com/britzl/defold-input/archive/master.zip](https://github.com/britzl/defold-input/archive/master.zip)) 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?

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 24, 2020, 9:02pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/6 "2020-03-24T21:02:31Z")

</div>

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]”**_

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 24, 2020, 10:17pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/7 "2020-03-24T22:17:00Z")

</div>

> [@Vgreen](#):
>
> 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?

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

> [@Vgreen](#):
>
> “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]”

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.

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 25, 2020, 12:03am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/8 "2020-03-25T00:03:25Z")

</div>

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

Thanks again

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 25, 2020, 4:30am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/9 "2020-03-25T04:30:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 25, 2020, 5:04pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/10 "2020-03-25T17:04:28Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 25, 2020, 6:38pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/11 "2020-03-25T18:38:49Z")

</div>

> [@Vgreen](#):
>
> Besides that, the multi touch still does not seem to be working

Can you share your input bindings?

Can you try the example project?

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 25, 2020, 8:53pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/12 "2020-03-25T20:53:38Z")

</div>

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:

 ![34%20PM](https://forum-defold-uploads.b-cdn.net/original/3X/c/8/c88e062e0a25d1818be41c9ec11eba36e2842a37.png)

Thanks again!

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 25, 2020, 8:58pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/13 "2020-03-25T20:58:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 25, 2020, 9:51pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/14 "2020-03-25T21:51:35Z")

</div>

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. 😅

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 - Copy.zip](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/3/5/354d9bdaa76c32760eb4629f9d4c8f810802f53b.zip) (6.9 MB)  
Thanks for all your help!  
V

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 26, 2020, 6:29am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/15 "2020-03-26T06:29:09Z")

</div>

> [@Vgreen](#):
>
> Here is the project so far: it works fine when I normally build it, the issue arrises when I build it to ios.

> [@Vgreen](#):
>
> 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…

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](https://defold.com/ref/stable/go/#on_input:self-action_id-action).

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: [https://github.com/britzl/defold-input/blob/master/examples/onscreen/onscreen.gui\_script](https://github.com/britzl/defold-input/blob/master/examples/onscreen/onscreen.gui_script)

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 27, 2020, 11:02pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/16 "2020-03-27T23:02:36Z")

</div>

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!

V

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 28, 2020, 6:33am UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/17 "2020-03-28T06:33:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 28, 2020, 4:54pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/18 "2020-03-28T16:54:59Z")

</div>

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 2.zip](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/5/6/56d2a8e353c2e7b8442fea4393b3204b48806f38.zip) (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!

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 29, 2020, 8:17pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/19 "2020-03-29T20:17:53Z")

</div>

> [@Vgreen](#):
>
> Not sure what is going on here.

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.

---

<div class="post-metadata">

**Author:** ![Vgreen](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vgreen/32/13343_2.png) [@Vgreen](https://forum.defold.com/u/Vgreen)\
**Post date:** [March 30, 2020, 7:06pm UTC](https://forum.defold.com/t/multiple-inputs-mobile/64688/20 "2020-03-30T19:06:42Z")

</div>

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?

Thanks!  
V

[Next page](https://forum.defold.com/t/multiple-inputs-mobile/64688.md?page=2)
