[Q] Overlapping when it shouldn't be?

Discussion and feedback on Construct 2

Post » Thu Jan 16, 2014 12:10 pm

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
B
4
Posts: 4
Reputation: 608

Post » Thu Jan 16, 2014 12:46 pm

It's by design. Two exactly adjacent objects count as overlapping in Construct 2.
Scirra Founder
B
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

Post » Thu Jan 16, 2014 12:57 pm

Oh. Never had thought that. Ah well, good to know.
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Thu Jan 16, 2014 1:12 pm

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,555
Reputation: 60,454

Post » Thu Jan 16, 2014 3:44 pm

Also to the OP if you really need to. Just change the collision box so that the 2 sides are 1 PX smaller.
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Fri Jan 17, 2014 9:43 am

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


B
4
Posts: 4
Reputation: 608


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 22 guests