I am having issues with getting input from an iPhone on html5 builds.
I have this simple “empty mobile” app on itch. It is built with Debug to get the prints but a Release version behaves the same. The only thing that I have changed is that I have added a script to print the input and change position of the logo. It works as it should on mac/windows but on iPhone the action_id is nil.
function init(self)
msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
print("action_id == ", action_id)
if action_id == hash("click") and action.pressed then
print('action_id == hash("click") and action.pressed - OKAY!')
go.set_position(vmath.vector3(action.x, action.y, 0), "/go1")
end
end
I tried other Defold games, I stumbeled upon Ben James Word Worm and on that it accepts the input. I downloaded the source for it and built it with 1.2.147 and the input stopped working. I asked Ben and he said he simply uploaded the “raw” html build. His setting for Word Worm is also identical to the Empy Defold project.
Am I missing something to be able to get input from iPhones on my html5 builds?
Here is the EmptyProject (2.5 MB) files if you want to verify everything.
But wait, you will get action_id == nil for mouse movement and action_id ~= nil when you press/release mouse button. And you are expecting action_id to not be nil while the finger touches the screen as you would for a native iOS build?
I am expecting action_id to be what mouse-button-left is assigned to when clicking on HTML5 including on an iPhone. Please understand that it works fine on on Android, Mac and Windows. It is only on iPhone that the behaviour is different. Hence the title.
I might be missing something obvious. So if someone could just download the Zip file and take a look I would be very graceful.
And Word Worm is working regardless of being logged in our out.
I did ask Ben about it when I notice this and he said the following
I don’t do anything special before uploading to itch.io. I use the same ZIP package made for the Defold community page - that is, the game in a directory then zipped up.
Here are they settings for Word Worm on itch.io - I hope it helps!
I notice in the video that even though it works it still give that weird “selected canvas” thing where it darkens it. On your website it doesn’t do that.
Just want to confirm, that I’ve faced the same issue on iOS and HTML5 builds made by Defold and uploaded to itch.io. Faced it somewhere in December, 2018 and don’t remember if I wrote about it on forum, it seems I did not. I’ve checked few other HTML5 games on itch.io and the bug reproduced in every Defold games I’ve found but did not reproduced in non-Defold games.
But I did not dig deeper, as it’s not my target platform, just put a Notice and direct link to index.htm on itch’s CDN (you can find it in page sources). Pure page works as expected, there is something in Itch’s JS and wrappers, I think. Hope you’ll find the real reason.