Finger dragging movement

Hi, I need help. I am making a vertical shooter for mobiles and I want my ship to move like professional games, that is, if I press the screen with my finger and move it to the right, the ship will go to the right, if I drag my finger to the left go left. (Same with up and down). I know that it is done with the MouseX() and MouseY() functions but it doesn’t work for me. This is my code. Thanks a lot

1 Like

Try using the concept of draggable camera example to make like that.

Hi! You can try the Swipe extension:

I don’t use it, so I can’t help you more than that.


Use swipe can also use double click extension to manage shooting

1 Like

Muchas gracias, probaré dicha extensión


Hello, I’m sorry to bother but I have tried the Swipe extension but I can’t get it to work: I slide my finger across the screen but my ship doesn’t move. Can you help me?. Thanks a lot. Here is the code that I used after assigning the extension to my Ship object.

save it as json file

1 Like

First of all thank you very much for your help. I have copied your text as Json and loaded it into Gdevelop and it gives me the following error. I have created in the folder of the error path the 2 pngs with the name that you put and it no longer gives me an error but when I execute it, no object appears on the screen, only the background of the castle. I would need an object to appear and slide my fingers across the screen to move it. Thanks a lot

This kind of errors can happend because you don’t have enough access with your Windows Session.
Be sure to execute GDevelop “As Administrator”.

Hello, I ran as administrator and it did not fail. However, it does not work, no object appears on the screen, only the background of the castle and when I slide my finger it does not detect well when I slide left, right, up or down. Could someone give me even a couple of screenshots of the events of an object that could be moved around the screen using the swipe extension? like my code that I put here but it works … Thank you very much

The Swipe extension topic has a demo example of how this module works (link). The Swipe operation implies fast movement of the finger (100 px must be traversed in 300 ms, these are the default settings, but they can be changed).

But, if I understand your idea correctly, then this extension will not suit you. You need to make a smooth movement of the ship relative to the movement of your finger (as for example in the game Sky Force Reloaded). In this case, look at the examples of the Geometry Monster game, which you can select when creating a project, or see the documentation for this example. It implements left-right movement relative to the finger. I think you will be able to make a movement up and down.
Good luck! =)

Thank you very much, it is just what I needed. I will prove it.

1 Like