local game = {}
local IMG_PATH = "games/credits/imgs/"

local _loadImage = loadImage
local function loadImage(file)
    return _loadImage(IMG_PATH .. file)
end

local function loadImages(prefix, from, to)
    if not to then
        to = from
        from = 1
    end
    local images = {}
    for i = from, to do
        table.insert(images, loadImage(("%s-%04d.png"):format(prefix, i)))
    end
    return images
end

function game:setup()
    self.bye = loadImages("bye-bye", 7)
    self.byeTimer = 0
    self.byeFrame = 0
end


function game:draw()
    background(0)
    textAlign(LEFT, TOP)
    text("Thanks for Playing!", 10, 10)
    text("Stuff I used to make the game:", 10, textHeight() + 10)
    text("LÖVE (https://love2d.org/)\nL5 (https://l5lua.org/)\nOpenNSFW Sound Pack SFXs (https://opennsfw.carrd.co/)\n\t- @SquishSuccubus\n\t- @KGF_Kiko\n\t- @DrDabblur\nFilmCow's Sound Effect Pack (https://filmcow.itch.io/filmcow-sfx)\nCC0 stuff from freesound.org", 10, textHeight() * 2 + 10)
    imageMode(CENTER)
    self.byeTimer = self.byeTimer + deltaTime / 1000
    if self.byeTimer > 1 / 12 then
        self.byeTimer = 0
        self.byeFrame = (self.byeFrame + 1) % 7
    end
    image(self.bye[1 + self.byeFrame], width / 2, height / 2)
    imageMode(CORNER)
end 

function game:keyPressed()
end 

return {
      name = "Credits"
    , themes = {"and", "and", "and"}
    , about = "Bye! Thanks for playing!"
    , game = game
    , id = 5
}
