How to make falling blocks

This forum is currently in read-only mode.
From the Asset Store
Place blocks on a board, join them together to form even bigger blocks!
  • Alright, as easy as it sounds, I haven't been able to do it yet.

    The best example would be the falling blocks in Mega Man 2, Bubble Man's level.

    You jump on the block, it falls, and reappears after a few seconds.

    The major problems I'm having is:

    1. When making the block a solid, the event does not execute. When unsolid, it works fine (but it needs to be solid! lol)

    2. The re-spawning of blocks doesn't work correctly.

    Here is a quick re-creation of my prob

    http://www.fileden.com/files/2008/3/4/1796632/fallblock.cap

  • I think the problem may be how fast you have them falling. You have it so that As soon as you collied with the object it makes it fall. Try adding a timer.

    So it could be like

    On Collision with Block and Platform
       + Set Variable falling to 1.
    
    Platform variable = 1
    Every 1000 Millisecond 
         add 1 to variable Timer.
    
    Timer greater than Strength
         Fall block set y = y-2
    [/code:52jkw4qn]
    
    Edit*
    so you would need to add private variables for strength and Timer...
    
    Now for the respawn:
    The original problem was you had the platforms spawning at themselves. 
    So here is a bit of code that I think will have the desired effect.
    
    [code:52jkw4qn]
    +Every 2000 Milliseconds 
    
      + Platform does not overlap Placer
               >Placer set Overlapped to 0
      + Placer:  'Overlapped' Equal to 0
          > SystemCreate object Fallblock 0  on layer 1 at (0, 0) from Placer 1 's pivot point
          > PlacerSet 'Overlapped' to 1
    
    [/code:52jkw4qn]
    
    The two other events are sub events and Overlapped is a Private variable in the Placer object.  This lets construct know which one to pick.   Hope this helped I have a cap with the respawn done but I gave you all the code if you want to see it I can upload it later.  Hope it all works out. 
    
    *Edit Again
    
    To make the block fall right that is the code except Make another collision object without the solid box checked on.  And set it so that it always sets it to player.x and player.y+ any amount that puts it where his feet would be. Set that object so that when it overlaps it set the timer to go off.
  • Thank you thank you thank you Mr. Aeal dude!!!

    I'm going to try it out tomorrow!

  • Would you mind i f I used this in my game if we find a need for it ( just the code).

  • NO WAY DUDE THAT;S LIKE COPYRIGHT INFRINGEMENT WTFORK OMGio;ferijfesroj;eosrgjse!!!111!1

    j/k

    its cool lol why would i mind?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • NO WAY DUDE THAT;S LIKE COPYRIGHT INFRINGEMENT WTFORK OMGio;ferijfesroj;eosrgjse!!!111!1

    j/k

    its cool lol why would i mind?

    You would be surprised... There are some who would just though id check

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