Issues with Overlapping at Offset

0 favourites
  • 4 posts
  • Hey, so I am having an issue with a project I'm working on. I'm trying to make a puzzle game and I want to use collision detection to determine when blocks should fall. Right now I have my project setup so it automatically creates an entire game field worth of blocks just so I can test basic mechanics and get things working.

    The issue I am running into is with the Event "Overlapping at Offset". Basically, every time a block is destroyed I start a sub-event which looks at all of the remaining blocks and tests them against the space below them. If the space is empty, it is supposed to cause the block in question to drop down into the empty space. Currently for simplicity I just have it changing an instance variable that is associated with the block. The problem is that for some reason it always detects a block, even when there isn't one there any longer. The only scenario where it is working and is not changing the state of the instance variable is for the blocks on the bottom row.

    I think there is an issue that the blocks are not actually being eliminated from the game fully, so when it checks they are still technically there even though they aren't showing up. This makes sense with the fact that the bottom row of blocks has no issue since there were never blocks below the bottom row.

    I am removing my blocks with the Destroy action and davesilvermanart.com/Chromathud.capx is a link to the current version of my project in-case you want to look it over to try and understand what I'm saying better.

    Basically my question is, does the destroy command eliminate an object entirely and prevent it from affecting collisions? If so, why might this be happening?

    Also, the way I currently have things setup the blocks are 44x44 pixels and the origin is in the center of the box. When I perform the check to see if there is a block below the one I'm looking at I have to look 45+ pixels below the block to make the bottom row work, but since my origin is in the center of the block, shouldn't I only have to look 23+ pixels below since 22 is half of 44?

    If anyone can help I would greatly appreciate it.

    PS: in-case you downloaded the game, the idea of the game is to add up blocks to equal the target. You select blocks with left-click, deselect with right-click, and blocks don't have to be touching to be used together.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Two sprites touching count as overlapping so the blocks are overlapping the ones beside them. When you check the bottom row at offset 45+ you've cleared the blocks on either side - that's why that works.

  • I've determined this cannot be the issue because I made it so that they spawn 6 pixels away from each other and it still does everything the same way it did before.Thanks for the advice though.

  • Sorry, I was wrong. This actually did resolve the issue. I ended up spacing the blocks more and now they work perfectly. I also realized I wasn't redrawing soon enough and thus it was accurate but was a delayed action. Thanks for the help.

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