notsanequarium/scenes/gameplay/draw/money.lua

16 lines
678 B
Lua
Raw Normal View History

2021-01-25 14:48:31 +00:00
local moneysheets = {
'coin1', 'coin2', 'star', 'diamond', 'chest'
}
2021-01-23 23:30:01 +00:00
return function(money, sheets, spritescale)
local sw, sh = love.graphics.getDimensions()
for _,f in ipairs(money) do
2021-01-25 14:48:31 +00:00
local sheet = sheets[moneysheets[f.type]]
2021-01-23 23:30:01 +00:00
local x = mix(f.x * sw, sw / 9 * 8, ease.outCubic(f.collecttimer))
local y = mix(f.y * sh, HEADER_HEIGHT - 20, ease.outCubic(f.collecttimer))
local frame = math.floor((f.time%1) * #sheet.quads) + 1
love.graphics.setColor(1, 1, 1, 1 - f.deathtimer)
love.graphics.draw(sheet.spriteSheet, sheet.quads[math.max(math.min(frame, #sheet.quads), 1)], x, y, 0, spritescale, spritescale, sheet.width/2, sheet.height/2)
end
end