Instant force working as permanent in mobile

I have touch controls for my game.
On pressing right arrow, I give it an instant force of X m/s. If works fine on web, however on mobile once I press a touch and release it, the object continues to move without stopping. Even so, at the next level, it continues with same speed without the arrow being touched at all. Pls help

Hello, Jayram!

I suppose that on the web you test with the mouse while the mobile with touch, right?
Probably the problem in mobile is because when you touch the screen the cursor move to where you touched. If you end the touch the cursor remains in the same place. And because most conditions for touch are also for cursor I believe that the cursor is activating the movement.

A way to resolve is desactive the cursor to move when you touch at beginning of the scene:

But I don’t know if that’s exactly your problem. Ideally, when you come to ask questions on the forum, it is to show a print of your events related to the problem so that people can analyze it.

@Rasterisko I have used the above condition as below.

If i put the above condition at the beginning of scene, the touch controls dont work at all.
If i put the above condition at the relevant touch specific events section, the right key condition doesnt work

You need a separate event just like I did in my screenshoot. Making like i said your touch controls don’t work anymore using a mobile and touching the screen? If yes, this is strange because the action just stops to move the cursor… does not change the touch.

Do you want your controls to work with both mouse and touch, or is touch enough?

Touch is enough for mobile
Yes, if I’m adding the move cursor : no condition at the beginning of scene, my touch arrows itself are not working. Is it because of some other part of the events/code?

@Rasterisko Below is the event list. The bug is that, if I press right arrow even once, the character gets a permanent force instead of just a right movement. If I add the

1 Like

You are right, Jayram. I’m sorry! You need remove the main condition that’s checking “Touch or Left mouse button is down”.

1 Like

Great! It worked, thank you :slight_smile: @Rasterisko

1 Like