public class Enemy {
    private double x;
    private double y;
    private double dx = 0.5;
    private double dy;

    private static final int MOVEMENT_DELAY = 5000;
    private boolean dead;

    private long lastLateralMovementUpdateTime;

    public Enemy(int x, int y, double dy) {
        this.x = x;
        this.y = y;
        this.dy = dy;
    }

    public void update() {
        x += dx;

        long currentTime = System.currentTimeMillis();
        if (currentTime - lastLateralMovementUpdateTime >= MOVEMENT_DELAY) {
            y += dy;
            lastLateralMovementUpdateTime = currentTime;
        }
    }

    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }

    public double getDx() {
        return dx;
    }

    public void setDx(double dx) {
        this.dx = dx;
    }

    public boolean isDead() {
        return dead;
    }

    public void setDead(boolean dead) {
        this.dead = dead;
    }
}
