How do I find out if there is an object in a position?

Just started using Construct 2? Post your questions here

Post » Fri Jun 16, 2017 4:52 am

I am making a sort of "Dont Starve" game and I'm having trouble finding an object in a position.

I want to do this because I want to adjust a "wall" sprite's image with its corresponding position.

e.g.

A B C
D E F
G H I

In the above, the A position should be a south-east (r) shaped wall.

Image

The B position should be a south-east-west (T) shaped wall.

Image

The E position should be a north-south-east-west (+) shaped wall.

Image

and etc . . .

I made all the versions of the wall as an animation so I just change the animation of an object to change the shape.

The problem is, I can't find a way to find out if there are existing wall objects in the North, South, East, and West position of a newly placed wall.

I need to find out if there are other walls so that I can set the new wall and the existing surrounding walls to the proper shape.

Any tips?
B
7
S
2
G
1
Posts: 7
Reputation: 989

Post » Fri Jun 16, 2017 10:31 am

Use overlapping test; 'is overlapping at offset' So you can check whether there is overlapping object at that offset position.
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226

Post » Fri Jun 16, 2017 11:05 am

'Is Overlapping at Offset' can be a real pain.

Why and more about auto tiling is discussed here;
quot-auto-tile-quot-help_t186871?&hilit=auto+tile
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jun 17, 2017 3:20 am

Thanks guys! I'll try to get something to work with your tips.
B
7
S
2
G
1
Posts: 7
Reputation: 989

Post » Sat Jun 17, 2017 10:15 am

Ah adaptive sprite/tile aka bitwise operation:

alextro wrote:I modified R0J0 example, make it compact & intuitive (and touch friendly) bitwise_mod.capx :idea:
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest