java - LibGDX + Box2D : Object Positioning -
i'm trying code breakout games libgdx , box2d. there 1 point don't understand. there must 2 bricks touch edge. on emulator saw 2 bricks nested. here's createbox method's code: private void createbox(float posx, float posy, float boxw, float boxh) { bodydef bodydef = new bodydef(); bodydef.type = bodydef.bodytype.staticbody; bodydef.position.set(posx, posy); body body = world.createbody(bodydef); polygonshape shape = new polygonshape(); shape.setasbox(boxw, boxh); fixturedef fixturedef = new fixturedef(); fixturedef.shape = shape; fixturedef.density = 1f; fixture fixture = body.createfixture(fixturedef); shape.dispose(); } edit: multiplied code. createbox(cons_holder.bricks_left_margin + (i * cons_holder.brick_width * 2 ), cons_holder.brick_top_screen_margin + (j * cons_holder.brick_height * 2 ) + cons_holder.bricks_top_margin, cons_holder.brick_width / 2, ...