On screen controls for mobile

Hi again! I’ve posted this question before but my teacher said I should repost it with better wording so it’s more clear

Since I’m on mobile, I need to make on screen controls since I can’t use a keyboard. I’ve found out how to make the controls to make the sprite moving but when I press the button, it doesn’t stop moving


This is my code so far
Any help is appreciated! Thank you in advance :]

Hey there,

You need to add “touch or Left mouse button is down” condition to your events, I think this will fix the issue.

Keep in that this method doesn’t work for multitouch if your game requires it.

Why would you programmatically add mobile controls if Gdevelop already has the function. Use Joystick instead.

https://wiki.gdevelop.io/gdevelop5/objects/multitouch-joystick/

Do not use cursor or touch

Add to your button behavior and in search bar type button
1st from the top should be Button states
Where after installation it will be called button fsm

After you have it it will give you conditions like
image

Where most likely you are interested in clicked and pressed
Clicked is as if you just touch and release it

Where you for controls are interested in pressed
Since it checks if you are holding it

And now your mobile buttons will work out of the box both with touches and mouse clicks

Also Danijel is correct

You should just install multitouch joystick

And now you add controller mapper to proper type of your game either platformer or topdown

Which will give you options to adjust controller as you want

This helped so much!! Thank you :]

I didn’t know- thanks!

I do need multitouch but thanks for replying :]

I always forget the name
But there is ACTION
Track mouse cursor or something like that
Just set it to no

Track cursor with touches? move cursor with touch? i do not remember
Easy to find but i can’t remember the name