Jump to content

Blocks collapse


Tubilok
 Share

Recommended Posts

I'd suggest not using physics at all - use tweens. Everything is meant to be aligned to a grid and physics systems just aren't good at that kinda thing. Here's a modified version of your fiddle with some cheap hacks to stop the stacks collapsing but they're just that; cheap hacks. I wouldn't use these for a proper game: http://jsfiddle.net/lewster32/23y28hwp/2/

Link to comment
Share on other sites

You should seriously use tweens:

-It's way cheaper in term of performances

-It's way more accurate (since you control everything)

 

A second solution would be to create your own tiny physic thing: Make everything have an increasing Y position until they reach something else's Y position.

That's the best alternative if you want to keep it "physic".

Link to comment
Share on other sites

I strongly urge you avoid using any physics systems for this, since I doubt any will be up to the job and will at best be hugely wasteful, perform poorly and introduce positioning inaccuracies which are absolutely not what you want in a grid-based game.

 

Take a look at this example - particularly the 'dropGems' function: http://examples.phaser.io/_site/view_full.html?d=games&f=gemmatch.js&t=gemmatch

Link to comment
Share on other sites

It seems to me that if all the boxes are the same size, are spawned on an x-axis grid and aren't meant to intersect, then it's likely to be a grid-based game. I could be totally wrong in my assumptions of course! If there's a need to actually have a stack of physics objects like that, then we really need more info about what it is Tubilok is trying to achieve.

Link to comment
Share on other sites

I'll take a look at the gemmatch example, although it seems rather complicated.

 

FYI, I want to do something like this:

 

 

I hoped it was something simple with Phaser but it seems I was wrong.

 

You are wrong in thinking that you are wrong. You are making a grid based game. When you spawn a box, you simply make a tween that brings it to the slot above the topmost box already in the column (my explanation might be vague). You do not need physics for the box part at all.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...