private void keepOnScreen() {
        if (rect.x < 0) {
            rect.x = 0;
            hitbox.x = rect.x + rect.width / 2 - hitbox.width/2;
        }
        else if (rect.x > world.getScreen().getWidth() - rect.width) {
            rect.x = world.getScreen().getWidth() - rect.width;
            hitbox.x = rect.x + rect.width / 2 - hitbox.width/2;
        }
        if (rect.y < 0) {
            rect.y = 0;
            hitbox.y = rect.y + rect.height / 2 - hitbox.height;
        }
        else if (rect.y > world.getScreen().getHeight() - rect.height) {
            rect.y = world.getScreen().getHeight() - rect.height;
            hitbox.y = rect.y + rect.height / 2 - hitbox.height;
        }
    }