Swiping Movement Game

Hi All,

I am trying to create a mobile game that uses swiping for movement as you move through a maze. I have tried virtually everything that I could find and could think of over the last few days. The game should have a similar movement style to a typical colour maze game, colliding with walls and stoping etc. If anyone has any suggestions or is able to help, I would be more than thankful.

Thanks

Can you provide screen shot of the swipe events? Or are you using the swipe gesture extension?

Apologies as I am very new to GDevelop. I have tinkered with all sorts through the last few days and have gone back to square one. I currently have no events set up as I now don’t really know where to start. All I have is a very basic level set up and an event to place the character (blue square) on the starting block.

UPDATE:

I managed to get movement with PixelPerfectMovement. I have new issues with non reliable and constant movement, and also I am still struggling to implement the swipe gestures I have tried to use the pre-made events in the swipe gesture extension. These are my events;

Don’t copy the events from the swipe extension. They will have condition and actions specific to functions, like GetArgumentAsString() and Set return value.

Instead, use the swipe extension like this (change the 10 to alter the touch sensitivity):

Thanks for your help, I have managed to implement the swiping controls. I still have a few questions if you wouldn’t mind helping me? First of all there are a few oddities when moving around such as the character being stuck in certain places and pushed round in others, and it feels like at times it won’t move then it will suddenly move for some reason. These are my updated events;


This is the link for the game at current if you would like to see the issues for yourself: https://gd.games/oliversbee/up-runner

What’s the collision box like for the car object? Because it seems like it may be a tad larger than the visible image.

Have you got 8 way top-down movement setting enabled? Turn it off, so it’s just 4 directions of movement. That may help the apparent sideways movement.

Finally, try placing the separate objects action after the movement events. It may may a difference.

Thank you, that seemed to do the trick. I think finally I am trying to make the car continuously travel until it hits a wall. I have been experimenting with using bounding boxes to compare positions to either simulate a key press or stop the car. The limitation of this is that there are walls on every grid height therefore comparing them returns the same value as the car is on, and won’t move the car. If you have any ideas as to how this could be implemented I would be very thankful. Again here is my updated events:

That bounding box detection is pointless. If it ever gets to that subevent, then the parent event’s action of simulating keypress will have already been actioned.

I think the following will do what you’re after (I haven’t included the actions for left and right).:

Yes, thanks the following helped however due to the fact that the character is constantly in contact with the walls the direction scene variable stays empty.


Is there a way in which you could test a bounding box for collisions, or get a similar effect where the collision box can stay in contact with the walls (this way the character stays centred in the maze)? i.e. test to see if the top bounding box is touching a wall, then chaining the variable back to empty

You can try to mitigate this issue 2 ways:

You can set the collision to ignore objects that are not overlapping but only touching edges:


Failing that, define 4 points outside if the car object, one outside each edge by 1 pixel.

Then instead of checking for car collision with the wall, check the point of the leading edge is in a wall object, and separate the car and wall if this is true.

So if the car is moving up, the point to check would be the one that’s in the horizontal middle and a pixel above the top edge.

Thanks, the first collision edges touching didn’t work however I had a little bit more success with the point inside object however I could not get that to work either. I hope these screenshots help to paint the picture. Once again I am very thankful for the help!



You could try making the collision box of the car one pixel narrower on each edge.

If that doesn’t work, define your own set of points (let us know if you need help with this), and remove that event with the bounding box condition. It’s not correct.

You want split each of the events that check the value of direction into 2 subevents; the first check that the relevant point is within a wall object, the second that simulates keypress if the point is not in a wall object, Something like:

Yes, thank you for your help it is all working now!