feat: add Tails and Amy to the charset
This commit is contained in:
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 |
|
@ -4,6 +4,9 @@ local folder = "assets/sprites/charset/"
|
||||||
local animation = {1, 2, 3, 2}
|
local animation = {1, 2, 3, 2}
|
||||||
local directionList = {"down", "right", "up", "left"}
|
local directionList = {"down", "right", "up", "left"}
|
||||||
|
|
||||||
|
local CHARWIDTH = 38
|
||||||
|
local CHARHEIGHT = 48
|
||||||
|
|
||||||
function Charset:new(scene)
|
function Charset:new(scene)
|
||||||
self.char = {}
|
self.char = {}
|
||||||
self.list = {}
|
self.list = {}
|
||||||
|
@ -22,15 +25,15 @@ function Charset:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Charset:addChar(ii, jj)
|
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 = {}
|
local char = {}
|
||||||
for i=1, 4 do
|
for i=1, 4 do
|
||||||
animatedDirection = {}
|
animatedDirection = {}
|
||||||
local running = {}
|
local running = {}
|
||||||
for j=1, 3 do
|
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)
|
--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
|
end
|
||||||
local direction = directionList[i]
|
local direction = directionList[i]
|
||||||
char[direction] = running
|
char[direction] = running
|
||||||
|
@ -59,13 +62,13 @@ end
|
||||||
function Charset:draw(charsetName, charID, direction, x, y)
|
function Charset:draw(charsetName, charID, direction, x, y)
|
||||||
local drawable = self.list[charsetName]
|
local drawable = self.list[charsetName]
|
||||||
local quad = self:getRunningFrame(charID, direction)
|
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
|
end
|
||||||
|
|
||||||
function Charset:drawStanding(charsetName, charID, direction, x, y)
|
function Charset:drawStanding(charsetName, charID, direction, x, y)
|
||||||
local drawable = self.list[charsetName]
|
local drawable = self.list[charsetName]
|
||||||
local quad = self:getStandingFrame(charID, direction)
|
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
|
end
|
||||||
|
|
||||||
return Charset
|
return Charset
|
||||||
|
|
Loading…
Reference in a new issue