TaggedEngine/states/creditsstate.lua
2025-07-07 20:41:30 +07:00

78 lines
1.9 KiB
Lua

local credits = {
{
name = "Entar (Owner)",
icon = "images/credits/entar.png"
},
{
name = "IDK (Helper)",
-- icon = "images/credits/idk.png"
},
{
name = "MarkedAman \n(Assets, DadBattle MRK Mix)",
icon = "images/credits/aman.png"
},
{
name = "Pankdoe (DadBattle MRK Mix vocals)",
-- icon = "images/credits/pankdoe.png"
}
}
local font = love.graphics.newFont("fonts/FridayNightFunkin-Regular.ttf", 60)
return function()
---@class StateClass
local state = {}
local currentOne = 1
local evilCurrentOne = 1
local icons = {}
function state.update(delta)
evilCurrentOne = Lerp(evilCurrentOne, currentOne, .05)
render.updateSprites(delta)
end
function state.draw()
render.drawSprites()
render.drawUI()
for index, credit in next, credits do
local color = index == currentOne and {0.5, 0.5, 0.5} or {0,0,0}
love.graphics.print({color, credit.name}, font, 150, love.graphics.getHeight() / 2 + (index - evilCurrentOne - 0.5) * 200)
if icons[credit.name] then
local icon = icons[credit.name]
icon.position = Vector2(0, love.graphics.getHeight() / 2 + (index - evilCurrentOne - 0.7) * 200)
end
end
end
function state.load()
local bg = Image("images/menuBG.png")
bg.layer = -5
for index, credit in next, credits do
local icon = credit.icon
if not icon then goto continue end
icon = Image(icon)
icon.position = Vector2(0, love.graphics.getHeight() / 2 + (index - evilCurrentOne - 0.7) * 200)
icons[credit.name] = icon
::continue::
end
end
function state.keypressed(key)
if key == "down" then
currentOne = currentOne + 1 > #credits and 1 or currentOne + 1
end
end
return state
end