darcys22 Posted September 2, 2014 Share Posted September 2, 2014 I am creating a game where a player can click on the screen to create bricks. I am trying to get these bricks to stack on top of this other and never overlap. I currently don't have any collision function being called when they collide (arcade) The defaults makes the bricks spring a little when they collide, they compress with weight, and after a few are stacked they fall through each other (even through my floor, which is an immovable sprite). Could someone point me in the right direction so I can tweak the arcade physics? It would be exactly how the pieces in tetris interact with each other. Thanks Link to comment Share on other sites More sharing options...
lewster32 Posted September 2, 2014 Share Posted September 2, 2014 This isn't practical with the physics engine, you need to approach this differently for the kind of game you're making, using grids and either tweens or some manual per-frame movement routine. Similar posts with more info can be found here:http://www.html5gamedevs.com/topic/7810-how-to-increase-rigidity-of-arcade-sprite-bodieshttp://www.html5gamedevs.com/topic/8658-blocks-collapse darcys22 1 Link to comment Share on other sites More sharing options...
darcys22 Posted September 3, 2014 Author Share Posted September 3, 2014 ah k, guess I'll look into using tweens for it. Thanks mate lewster32 1 Link to comment Share on other sites More sharing options...
lewster32 Posted September 3, 2014 Share Posted September 3, 2014 No problem - let us know how you get on! Link to comment Share on other sites More sharing options...
darcys22 Posted September 4, 2014 Author Share Posted September 4, 2014 Okay so I made the bricks fall using a tween, then when they overlap with another brick (Overlap without physics tutorial) I stop the tween. However they are also draggable so when one of the bricks underneith is moved I would like them to continue falling. Is there an easy way of doing this? Link to comment Share on other sites More sharing options...
lewster32 Posted September 4, 2014 Share Posted September 4, 2014 When you drag the brick, does it remove it from the playing area temporarily while it's held, or can things collide with it during the dragging? If so, then this will be rather difficult to get working. The way these things are typically done in Tetris, Candy Crush and so on is via an underlying data structure that represents the grid. Each 'cell' either has something in it, or not, and the positions of things on this grid influence the smoothed tweens of the visual objects. See this example: http://examples.phaser.io/_site/view_full.html?d=games&f=gemmatch.js&t=gemmatch Link to comment Share on other sites More sharing options...
Recommended Posts