I need help with this expression.

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Here's the .capx: https://dl.dropbox.com/u/1910765/problem.capx

    Basically, you destroy the blocks clicking on them, and when you do the blocks that are on top of the one you destroyed "fall" down on top of the others.

    The blocks on the left work fine because they are all the same size, but the the other 2 piles if you destroy the bigger block, the ones on top won't fall down enough because in the events I only move them +40 pixels.

    You can find that on the events where it says Blocks->Set position Self.Y+40

    So what I need is to change that Self.Y+40 to some kind of expression that finds the correct distance between the blocks on top and the checkdummy object, so even when the blocks are larger, once you destroy them, the blocks on top will position themselves correctly.

    The checkdummy object is the grey sprite that it always positions itself on top of the pile, so everytime you destroy a block, this will create a gap and the checkdummy will position itself there. I thought this could come in handy, but since I suck at math I have a really hard time with expressions, maybe you guys can think of something.

    Also, I need to do this with that one expression preferably, I don't want to have a bunch of different events depending on the size of the block.

    Of course if you know of a better way to do this let me know too. Thanks. Feel free to ask anything.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't open the project at this moment, but could Set position to checkdummy.y work?

    Maybe because the blocks are different size, checkdummy.y-0.5*sprite.height or something like that?

  • I think a new rule for those posting projects to get assistance on: declare all custom plugins you have installed.

  • Try again please, I forgot to delete a behavior. Sorry.

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