I use dynamic bodyType for the blocks but the blocks falling down when stack too high .
local physics = require "physics" physics.start() physics.setGravity(0,15) local myGroup = display.newGroup() local land = display.newRect(200,400,400,10) physics.addBody(land,"static",{ density= 3.0, friction=0.5, bounce=0 } ) myGroup:insert(land) local y = 200 local function spawn() local block = display.newRect(200,y,50,50) myGroup:insert( block) physics.addBody(block,"dynamic",{ density=3.0, friction= 0.5, bounce=0 }) y = y - 50 myGroup.y = myGroup.y +30 end timer.performWithDelay(2000,spawn,0)
Well in the real world if you stacked blocks that uneven, the entire structure would fall like you’re seeing. I suspect the video is either a) removing the old blocks that are off screen or b ) or are being made inactive. See: https://docs.coronalabs.com/api/type/Body/isBodyActive.html
Either technique would solve the problem. Though I personally would let it collapse, take points away for blocks that fall off the structure and make them build back up… But that’s me.
Well in the real world if you stacked blocks that uneven, the entire structure would fall like you’re seeing. I suspect the video is either a) removing the old blocks that are off screen or b ) or are being made inactive. See: https://docs.coronalabs.com/api/type/Body/isBodyActive.html
Either technique would solve the problem. Though I personally would let it collapse, take points away for blocks that fall off the structure and make them build back up… But that’s me.