Alternatives to Falling Blocks without Physic

0 favourites
From the Asset Store
Merge Blocks - Full Game
$19.60 USD
60% off
Place blocks on a board, join them together to form even bigger blocks!
  • Hi pals!

    I would like to have a special solution how to alternate falling blocks and they stop falling if they hit to each block without using physics behavior.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bullets with gravity and maybe some bounce seems like a good start

  • I making a puzzle where the blocks fall when some blocks were destroyed, sometimes i use custom movement behavior or y+ every tick. It was bad practice, then im looking best practices to mantain performance for mobiles without Physic.

  • Could you store your blocks in an array , when a block is removed then step "up" through the array setting these blocks to fall ?

    Or if you give each block sprite an x and y variable then could you select the required x sprites with a condition (hope these are the right terms)

  • Been playing with the above idea

    dl.dropbox.com/u/143636437/temp/gem1.capx

  • RamPackWobble, it's quite good BUT how do you animate falling blocks?

  • dl.dropbox.com/u/143636437/gemstest/invaders.capx

    Having problems getting my head around the bullet behavior (thought it had a bug but it looks like I was wrong (again)). might need a custom movement system...

    Anyway, might point you in directions you hadn't thought about...although they could be the wrong directions !

  • dl.dropbox.com/u/143636437/gemstest/invaders.capx

    Having problems getting my head around the bullet behavior (thought it had a bug but it looks like I was wrong (again)). might need a custom movement system...

    Anyway, might point you in directions you hadn't thought about...although they could be the wrong directions !

    Nice! Sometimes is not perfect at all, but it's still working like a charm! Thanks <img src="smileys/smiley32.gif" border="0" align="middle" />

  • RamPackWobble i posted a .capx what i'm having performance problem with CocoonJS.

    http://www.scirra.com/forum/topic63583_post390047.html#390047

    Your .capx seems a nice solution, but im figuring out how to keep correct positions, if you keep clicking any blocks and they get wrong position.

  • Btw, a reference

    <img src="http://i.imgur.com/2Z2H1km.png" border="0" />

  • A couple of ideas...

    Set some flag that says if anything is falling which is checked before you can start any more from starting to fall

    I don't have the code with me, so from memory - when you touch an invader/gem it goes through the ones above and sets them to fall a set distance from their present y pos. I think the problem is that if , while falling, it is set to fall again. Some instance variable that says this this is where I am already falling to so add any further falling distance to this and this new (total) y position is where I will stop falling.

  • OK fired up the old laptop and went with option two.

    https://dl.dropbox.com/u/143636437/invaders/index.html

    capx updated.

  • I solved this for my WIP game by using easeTween, Array of UID's. It's a bit complicated and until I finish the game I'm a bit reluctant to share capx :)

    When each instance is created I assign it to the corresponding Column ( I use floor(sprite.X / sprite.Width) to get 0-10 for 10 columns for example ) and store the UID's for each in a 2D array (GameBoard). When you remove an instance it's deleted from the array (set value to 0)

    To drop them I just add them and drop them by using easeTween(relative) setting Target X to (GameBoard.Height - ColumnCount) * Sprite.Height ( (10 - 2 )*80) . Setting easeTween with an easeBounceOut makes them look like physics objects too.

    When you remove a assets I call a function UpdatePositions which just run's through all the populated GameBoards UID's and counts how many blank spots are below. Repeat GameBoard.Height - Sprite.GameBoardY (repeats down 10-8) and then if Array's Spot is 0 add 1 to MoveAmount else do nothing.

    Then at the end it just move the Sprite it was testing by MoveAmount * Sprite.Height using easeTween again.

    Maybe if I get some time I can produce a stripped down capx to show.

  • RamPackWobble you only added some function when you click a block while is falling, it doesn't destroy.

    Here comes an annoying issue, if you try to destroy a group of blocks, they won't fall. Also i used your codebase, it breaks the game when i tried to spawn another from above and it goes wrong position, it's overlapping to next 4 blocks down.

    Are you thinking to use comparing 2 values Block.Y and Block.Height? i tried it, but i couldn't figure out.

    http://dl.dropbox.com/u/76227787/wrongfallgroup.capx

    labithiotis Oh really? I have a question, when some blocks were destroyed (including destroyed single block and multiple blocks) and spawn another blocks from above then fall, would it work?

  • Anyways, i created a thread if you want help me, in return you get a reward

    http://www.scirra.com/forum/topic63653.html

    You can replace a workaround in event number 10, it shouldn't be collision check

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