Movement of the player

Hello everybody !

It’s my first time posting here and first time I am using GDevelop so I’m still a newbie.

So i’m making my first game and i have some trouble with player movement.

My sprite moves from left to right automatically using two objects left and right and a variable ‘‘direction’’ like in the tutorial. I want that my player changes direction when you touch the screen. So I tried to do an event so when the player touches the screen the variable direction changes to left or right depending on the condition if the variable is left or right. The problem is it work only for one direction.

For example when i touch the screen the variable is changed and the sprite goes in the opposite way. But when i touch it again there is a bug of the animation and the sprite doesn’t change it’s direction.

Thank you

Hi !

I’m not using a game template i’m building it from scratch.
When the layer is not visible anymore the sprite starts moving from left to right automatically

And i want my player to change his direction when i touch anywhere on the screen so i tried this

1 Like

But it works only when the player is going to the left. When the sprite goes to the right there is a glitch and it won’t change direction. I want it to change direction when you touch the screen. If it goes left you touch the screen and it goes right and if it goes right and you touch the screen it goes left.

Thank you for your reply

1 Like

No my game is not isometric and don’t worry about English. Mine isn’t perfect neither !

Thank you for replying and trying to help !

1 Like

Try to look at this project:

1 Like