예제 #1
0
  public static Body createGround(
      World world, float x, float y, float width, float height, float restituition) {

    BodyDef bodyDef = new BodyDef();
    bodyDef.position.set(new Vector2(x, y));
    Body body = world.createBody(bodyDef);
    PolygonShape shape = new PolygonShape();
    shape.setAsBox(width / 2, height / 2);
    Fixture fixture = body.createFixture(shape, Constants.WALL_DENSITY);
    fixture.setRestitution(restituition);
    body.setUserData(new GroundUserData());
    shape.dispose();
    return body;
  }