public void tick() {
        if (System.currentTimeMillis() - lastTime >= delay) {
            lastTime = System.currentTimeMillis();
            currentFrame = (currentFrame + 1) % sprites.length;
            sprite = sprites[currentFrame];
        }
    }