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

  • 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.

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

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

    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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use overlapping test; 'is overlapping at offset' So you can check whether there is overlapping object at that offset position.

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

    Why and more about auto tiling is discussed here;

  • Thanks guys! I'll try to get something to work with your tips.

  • Ah adaptive sprite/tile aka bitwise operation:

    I modified R0J0 example, make it compact & intuitive (and touch friendly) bitwise_mod.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)