feat: add Tails and Amy to the charset

This commit is contained in:
Kazhnuz 2020-08-02 21:55:37 +02:00
parent b2fe9e62cd
commit d3cb2c9052
2 changed files with 8 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -4,6 +4,9 @@ local folder = "assets/sprites/charset/"
local animation = {1, 2, 3, 2}
local directionList = {"down", "right", "up", "left"}
local CHARWIDTH = 38
local CHARHEIGHT = 48
function Charset:new(scene)
self.char = {}
self.list = {}
@ -22,15 +25,15 @@ function Charset:update(dt)
end
function Charset:addChar(ii, jj)
local charx, chary = (jj-1)*(24*3), (ii-1)*(32*4)
local charx, chary = (jj-1)*(CHARWIDTH*3), (ii-1)*(CHARHEIGHT*4)
local char = {}
for i=1, 4 do
animatedDirection = {}
local running = {}
for j=1, 3 do
local x, y = charx + ((j-1)*24), (chary + (i-1)*32)
local x, y = charx + ((j-1)*CHARWIDTH), (chary + (i-1)*CHARHEIGHT)
--print(x, y)
running[j] = love.graphics.newQuad(x, y, 24, 32, 24*12, 32*8)
running[j] = love.graphics.newQuad(x, y, CHARWIDTH, CHARHEIGHT, CHARWIDTH*12, CHARHEIGHT*8)
end
local direction = directionList[i]
char[direction] = running
@ -59,13 +62,13 @@ end
function Charset:draw(charsetName, charID, direction, x, y)
local drawable = self.list[charsetName]
local quad = self:getRunningFrame(charID, direction)
love.graphics.draw(drawable, quad, math.floor(x), math.floor(y), 0, 1, 1, 4, 16)
love.graphics.draw(drawable, quad, math.floor(x), math.floor(y), 0, 1, 1, 11, 32)
end
function Charset:drawStanding(charsetName, charID, direction, x, y)
local drawable = self.list[charsetName]
local quad = self:getStandingFrame(charID, direction)
love.graphics.draw(drawable, quad, math.floor(x), math.floor(y), 0, 1, 1, 4, 16)
love.graphics.draw(drawable, quad, math.floor(x), math.floor(y), 0, 1, 1, 11, 32)
end
return Charset