# Is it Possible To Check For Objects Position?

Get help using Construct 2

### » Mon Jul 01, 2013 6:32 am

Here just a quicky showing the bounding box expressions.
bbox-print.capx

The Top and Bottom values are the same, and the Right value = Left value of the adjacent tile. (You may want a buffer of a pixel or two when calculating).

The algorithm is simply, pick the tile to compare, and cycle through every other tile to see if it's Top and Right equal the Top and Left of the other tile. If so, they are adjacent (on the right). You can do the opposite to check the left-side.blackhornet2013-07-01 06:58:05
B
71
S
22
G
273
Posts: 3,822
Reputation: 150,787

### » Mon Jul 01, 2013 7:51 am

@blackhornet as easy as that looks im not understanding whats going on.
I dont want to sound lame but i am unaware of the expression your using.

this is what i found in the manual.
Size & Position
BBoxLeft
BBoxRight
BBoxTop
BBoxBottom
Return the layout co-ordinates of the object's axis-aligned bounding box. This is the smallest unrotated box that completely encloses the object, taking in to account any rotation or stretching.

I understand that its calling for the bounding box,But how does this work?
I dont understand whats going on in your capXRookieDev2013-07-01 08:36:09
GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

### » Mon Jul 01, 2013 4:05 pm

bbox-sample.capx

This prints each tile's BBox coordinates. As you can see, adjacent tiles share the same value for the Right of the one tile, and the Left of the adjacent tile.

By scanning all of the tiles, you can detect which share a 'wall', let's call it, and are therefore adjacent.

If this is still too much, you may want to give arrays another try. There are several tutorials on arrays on the site.
B
71
S
22
G
273
Posts: 3,822
Reputation: 150,787

### » Mon Jul 01, 2013 7:16 pm

@blackhornet

i think you are right about the BBox Example,It might be alittle out of my leauge for now.
as for Arrays,Im trying to learn them but i fail when it comes to actually making the tile i want appear on the layout.
I need to figure out the easiest way possible to lay blocks through arrays.I dont need random i just want a flatland.
Once i learn how to make a flatland generate i could move to the more complicated random.
GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

### » Mon Jul 01, 2013 8:42 pm

array-sample

I know there's a lot here, but try to draw it out on some graph paper, if you have some. X along the top, Y down the side, and walk through the algorithm.blackhornet2013-07-01 20:43:31
B
71
S
22
G
273
Posts: 3,822
Reputation: 150,787

### » Thu Jul 04, 2013 8:32 pm

So from what i have learned so far there are only three ways to check if an object is beside another object.
The three ways i have been told are not what im looking for,The closest is arrays but i dont really get them thats why i dont want to implement them in this game.
I would love to know if there are more ways to check if an object is next to another object.
GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

### » Sun Jul 14, 2013 8:23 am

AnyOne?
GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

Previous