def createWorld(self, world): bd = BodyDef() ground = world.createBody(bd) shape = EdgeShape() shape.set(Vector2(-40, 0), Vector2(40, 0)) ground.createFixture(shape, 0.0) shape.dispose() shape = PolygonShape() shape.setAsBox(0.6, 0.125) fd = FixtureDef() fd.shape = shape fd.density = 20.0 fd.friction = 0.2 jd = RevoluteJointDef() jd.collideConnected = False y = 25.0 prevBody = ground for i in range(30): bd = BodyDef() bd.type = BodyType.DynamicBody bd.position.set(0.5 + i, y) body = world.createBody(bd) body.createFixture(fd) anchor = Vector2(i, y) jd.initialize(prevBody, body, anchor) world.createJoint(jd) prevBody = body shape.dispose()