How can I change the key for the touch in the middle of the game


I’ve made a game with buttons that simulated the arrow keys (up, down, right, left).

I want to do a variable that change the arrow keys for the button (right become left and left become right)

I tried with this

but it doesn’t work and i don’t know why?

Thanks for helping

So you use the buttons for left and right and they work correctly? But when you want to do them opposite they do not work correctly?

Exactly, the character don’t move with the button but it works directly with the arrow keys.

It’s to play on a mobile, so i don’t have the keys.

Oooh none of the buttons work to move the player?

I change only left and right, os the left and right doesn’t work.
Jump, up and down still works

But you only want the left button to move Ln to the right and the right button to move to the left? You don’t have other events to move left if the cursor is on the left button or right when it is on the right button?

No it’s only Ln that have to move

To test it, does it work if you take out the scene variable = 10?

If i remove the variable, it doesn’t work from the beginning of the level

I don’t know what it could be, unless you disabled the cursor somewhere.
I tried it and the only annoying thing that happens is when I lift my finger the cursor stays on the button and keeps me moving or jumping.

I didn’t find why it doesn’ work but i can fix it with this

I delete buttons and create new one with the new keys.

1 Like

Good job I never would have thought of that!