[Solved] How do I Run An Event Based on Distance Between...

Get help using Construct 2

Post » Sun May 24, 2015 1:56 am

Hey guys! So I'm developing a tile-based game where you move around tiles by tapping the tile you want to move then tapping an open space to solve the puzzle, but I've run into a snag.

I'm trying to get the tiles to only move to the one available open space if it is IMMEDIATELY above, below, or next to it. Currently the tiles are able to move to the open position regardless of their position, but I need them to only be able to move if they're right next to the open spot.

The idea is that I need a way for the tile tapped on to read the distance between itself and the open space. If the distance is too great, it shouldn't be able to move. If it is the right distance, it should be able to move.

Here's a visual of the issue I'm talking about for you visual learners out there.

Image
Image
Last edited by Masai on Mon May 25, 2015 6:52 am, edited 1 time in total.
B
9
S
2
Posts: 34
Reputation: 679

Post » Sun May 24, 2015 2:28 am

How are you setting up your grid?
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

Post » Sun May 24, 2015 2:32 am

newt wrote:How are you setting up your grid?


Just by placement, nothing special. I'm not using any kind of tilemap or what have you. I have variables set up to store the locations of whatever is tapped, so there doesn't need to be any special framework for a grid. I'm still working on it and I got it functioning a bit more properly. Now tiles in the -x of the open space will go to the open space, but nothing else will. Still playing with it.
B
9
S
2
Posts: 34
Reputation: 679

Post » Sun May 24, 2015 3:00 am

Last edited by korbaach on Sun May 24, 2015 12:30 pm, edited 1 time in total.
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Sun May 24, 2015 6:15 am

korbaach wrote:just a thought..

capx> http://s000.tinyupload.com/index.php?fi ... 3415084296


Can't open the file. My version is a bit older since I'm running on Steam's version of Construct 2. Can you screenshot the necessary stuff?
B
9
S
2
Posts: 34
Reputation: 679

Post » Sun May 24, 2015 11:01 am

Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Sun May 24, 2015 4:24 pm

korbaach wrote:capx> http://s000.tinyupload.com/index.php?fi ... 7651153194
(Latest Stable-r200)


This is pretty much perfect! Thanks a lot.
B
9
S
2
Posts: 34
Reputation: 679


Return to How do I....?

Who is online

Users browsing this forum: evillair, gamecorpstudio, jorgmaquoi, Yahoo [Bot] and 24 guests