[Q] Overlapping when it shouldn't be?

0 favourites
  • 6 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi guys.

    I'm in the process of learning Construct 2, and started to try my hand on making a simple Sokoban clone.

    Since such a game is grid based, the movement should be constrained to the grid's cells.

    However, I noticed something that I thought was a little weird, and I hope someone can enlighten me about it.

    File URL (not allowed to post links yet - but just remove the space from behind the https:// and you'll get it):

    https:// drive.google.com/file/d/0B6we8Zrx-RfLYmtqOWdoelVBdEk/edit?usp=sharing

    Description of linked .capx file

    • A small room built from 32x32 pixel wall segments
    • Within, a "player" object (also 32x32 pixels) resides
    • All the walls and the player are aligned to a 32x32 grid
    • The "player" is movable by repeatedly pressing the arrow keys, jumping 16 pixels (half a grid cell) in wanted direction
    • Any wall segment that is overlapped by the "player" will be half transparent

    The weird part of this is that even though the "player" is placed next to a wall, that wall will be considered overlapped by the player.

    I guess this is by design, but it feels like it's not really overlapping, or am I missing something terribly obvious?

    Thankful for any help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's by design. Two exactly adjacent objects count as overlapping in Construct 2.

  • Oh. Never had thought that. Ah well, good to know.

  • It seems perfectly logical to me.

    The edge of the 32 pixel wide sprite is in line with a 32 pixel opening, so it can't possibly fit into it.

    It would need to be at least 1 pixel smaller on each side for it to fit.

  • Also to the OP if you really need to. Just change the collision box so that the 2 sides are 1 PX smaller.

  • Thanks guys.

    Yeah, making the "player" collision rectangle span from (0.1, 0.1) - (31.9, 31.9) makes it so that I can test the "Is overlapping with offset" condition with more predictable results

    <img src="smileys/smiley1.gif" border="0" align="middle" />

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