# How do I give directions with swipe

0 favourites
• 10 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
• Hi there valuable forum members

What I am trying to accomplish is here to make 2048 type of game but rather than generating numbers and moving the whole group in xy coordinates by swiping anywhere in the screen , I will put the numbers on 10x10 board on a big background and move the number boxes in xy axes one by one with a flick of right-left or up&down swipe.

I have checked almost the whole forum but couldn't find what I am looking for and the current 2048 demo was too advanced for me to figure out and make changes and do something like I want.

• This is one way of doing it

• thank you for the capx but this is not even close to what i am trying to describe here, as i said on my email, the object it supposed to go from one edge to the other edge on the board with a flick of swipe unless its collides with an object like in 2048 game.

here is the sample board

https://dl.dropboxusercontent.com/u/29466702/sample.png

• you mean like this

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• i mean like this but i dont know how can i make a board to stop the box movement inside of the board and and how can i make it only move in 4 direction rather than 8 direction. and also it doest stop when its collide with solid objects as well.

• For using only 4 directions you need to round to the nearest 90 degrees like this.

viewtopic.php?f=147&t=109106&p=798244&hilit=angle+round#p798244

For stopping you need to check each grid spot in the direction of motion. Here I added 32 to the distance to move for each free spot and stop once I come to a spot that isn't free.

The checking is accomplished with overlapping at offset in a loop. I used a little trig but you could just duplicate the loop 4 times depending on the direction and use (32,0) and such directly. One slight technical thing I used was scaling the object being swiped down before the check loop and and back up after. This is to overcome the fact that adjacent sprites will count as overlapping.

https://www.dropbox.com/s/3sh6btc51vzss ... .capx?dl=0

• This is exactly what i am looking for, and it helped me a lot to get the main idea, now i can build up my game on to this

Thank you so much for your help

• Good one R0J0hound to rescue