23 lines
681 B
Lua
23 lines
681 B
Lua
local Animation = require "animation"
|
|
local Atlas = require "atlas"
|
|
|
|
local function spannedState(atlas, row, len, on_finish, next)
|
|
local start = (row - 1) * atlas.w + 1
|
|
local animation = Animation:new_spanned(atlas, start, start + len - 1)
|
|
return { animation = animation, on_finish = on_finish, next = next }
|
|
end
|
|
|
|
local leafRanger = Atlas(love.graphics.newImage("assets/leaf-ranger.png"), 288, 128)
|
|
|
|
return {
|
|
{
|
|
name = "Leaf Ranger",
|
|
states = {
|
|
idle = spannedState(leafRanger, 1, 12),
|
|
run = spannedState(leafRanger, 2, 10),
|
|
hurt = spannedState(leafRanger, 16, 6, "goto", "idle"),
|
|
death = spannedState(leafRanger, 17, 19, "stop"),
|
|
}
|
|
}
|
|
}
|