Collision triggering one event at a time

  • Add an instance variable to the falling block. Call it whatever you like, something that makes sense like fallcounter for example. Set the variable as a number and the value to 0. Each time the block hits the square, add one to the variable.

    Create a check for that number being equal to 3. If it is, destroy the block. This will of course stop it falling. To get it started again, just create a new on when you need it.

    <strike>I can't create a CAPX to show you because I can't find how Kyatric has set the box to drop! Unless it's because I have the free version and I can't see the event. Can you explain how you got the block to reset each time it dropped Kyatric?</strike>

    I found out how (using he WRAP behaviour). I've changed the CAPX so it checks the number of the instance variable (of the falling block) and destroys the block if it equals 3 (remember it counts from 0 so 0,1,2 is makes it fall 3 times).

    EDIT - I've changed the CAPX again so this time it will randomly select a number and set the animation frame of the blocks to that number. Instead of doing it that way, you could make the same animation frames for the falling block, then on collision with the player set the animation frame of the number block to match the number of the falling block.

    That way, if a number 3 falls and the player touches it, set the fading in block animation frame to 3 and it all ties in. If I'm not making much sense it's because I'm tired, I need my bed lol.

    CAPX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow. Exactly what I needed. Awesome! You just got rid of like 90% of my stress!

    Thanks so much everyone! I knew you guys would help :3

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