Doki
October 21, 2024, 12:08pm
1
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 :]
insein
October 21, 2024, 3:19pm
2
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/
ZeroX4
October 21, 2024, 8:01pm
4
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
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
Doki
November 8, 2024, 7:58am
5
This helped so much!! Thank you :]
Doki
November 8, 2024, 8:00am
8
I do need multitouch but thanks for replying :]
ZeroX4
November 8, 2024, 8:25am
9
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