playerPhysicsFixture.setFriction(0f); playerSensorFixture.setFriction(0f); } else { if (!Gdx.input.isKeyPressed(Keys.A) && !Gdx.input.isKeyPressed(Keys.D) && stillTime > 0.2) { playerPhysicsFixture.setFriction(1000f); playerSensorFixture.setFriction(1000f); } else { playerPhysicsFixture.setFriction(0.2f); playerSensorFixture.setFriction(0.2f);
public Body createBallBody(float x, float y, float radius) { x = x/scale; y = y/scale; radius = radius/scale; BodyDef def = new BodyDef(); def.type = BodyDef.BodyType.DynamicBody; def.position.set(x, y); Body body = world.createBody(def); CircleShape shape = new CircleShape(); shape.setRadius(radius); shape.setPosition(new Vector2(radius, radius)); Fixture fixture = body.createFixture(shape, 1); fixture.setFriction(0); fixture.setRestitution(1); shape.dispose(); return body; }