How do I give directions with swipe

Get help using Construct 2

Post » Wed Oct 08, 2014 9:44 am

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.
Can someone please help me about it?
B
13
S
3
Posts: 59
Reputation: 1,589

Post » Wed Oct 08, 2014 10:50 am

This is one way of doing it
You do not have the required permissions to view the files attached to this post.
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753

Post » Wed Oct 08, 2014 11:58 am

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
B
13
S
3
Posts: 59
Reputation: 1,589

Post » Wed Oct 08, 2014 1:54 pm

you mean like this
You do not have the required permissions to view the files attached to this post.
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753

Post » Wed Oct 08, 2014 2:33 pm

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.
You do not have the required permissions to view the files attached to this post.
B
13
S
3
Posts: 59
Reputation: 1,589

Post » Wed Oct 08, 2014 9:14 pm

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
Last edited by R0J0hound on Fri Apr 14, 2017 6:11 pm, edited 1 time in total.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Wed Oct 08, 2014 9:45 pm

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
B
13
S
3
Posts: 59
Reputation: 1,589

Post » Thu Oct 09, 2014 6:52 am

Good one R0J0hound to rescue
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753

Post » Fri Apr 14, 2017 1:00 pm

@R0J0hound

Just wondering if you can upload the capx again? Can't download it. Thanks!
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Fri Apr 14, 2017 6:11 pm

fixed
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 18 guests