Problem creating touch controls for mobile platform game


#1

Hi all,
i’ve created simple controls for a touch platform game. When i touch and hold left/right and then jump the player jump left/right. But when i release the jump, still holding the right/left control, the player stops moving…why? :confused:

touch-problem.png


#2

I don’t know is this working or helping anything but check the example “Multitouch.gdg” in GDevelop example folder.


#3

Hi,

The “Touch or Left mouse button is down” only works with single touch. So, when you release one finger, the condition stops from being true and your player stops moving. Just remove this condition (from all the events) and it will work (“Cursor/touch is on XXX” already tests if the touch is on one object, with multitouch support).


#4

Thanks Victor, but removing “Touch or Left mouse button is down” the action never stops. For example if i press left and put the finger off the screen the player continues moving in that direction…!


#5

Yo!

I have the same problem…


#6

I forgot that you also need to disable the “moving cursor with touch” feature to allow the multitouch to work. This can be achieved by adding the “deactivate moving mouse cursor with touches” (“Mouse and touch” category) at the beginning of the scene.

You can see an example of touch controls by creating a new project with the “HTML5 > Platformer” template.


#7

Great! Thank you very very much! :slight_smile:


#8

Thank you so much​:heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart: