2021-07-04 11:43:46 +02:00
|
|
|
local Scene = require "birb.modules.scenes"
|
|
|
|
local menu = require "scenes.debug.viewers.animation.menu"
|
|
|
|
|
|
|
|
local CharAnimViewer = Scene:extend()
|
|
|
|
local Background = require "game.modules.drawing.parallaxBackground"
|
|
|
|
local Sprite = require "birb.modules.assets.types.sprites"
|
|
|
|
|
|
|
|
|
|
|
|
function CharAnimViewer:new()
|
|
|
|
CharAnimViewer.super.new(self)
|
2021-08-15 16:01:25 +02:00
|
|
|
self.assets:batchImport("assets.debug")
|
2021-07-04 11:43:46 +02:00
|
|
|
local mainMenu = menu.commons.DebugMenu(self, "MainMenu")
|
|
|
|
|
|
|
|
self:setBackground("city")
|
|
|
|
|
|
|
|
for charName, _ in pairs(game.characters.list) do
|
|
|
|
mainMenu:addSubMenu(charName, charName)
|
|
|
|
local sprite = Sprite("datas/gamedata/characters/" .. charName .. "/sprites")
|
|
|
|
for animName, _ in pairs(sprite.data.animations) do
|
|
|
|
menu.AnimationWidget(self, charName, animName)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
menu.commons.SceneWidget(self, "MainMenu", scenes.debug.menu, "Back")
|
|
|
|
|
|
|
|
self.menusystem:activate()
|
|
|
|
self.menusystem:switchMenu("MainMenu")
|
|
|
|
|
|
|
|
self.sprite = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
function CharAnimViewer:constructMenu()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function CharAnimViewer:setSpriteAndAnim(character, animationName)
|
|
|
|
self.sprite = Sprite("datas/gamedata/characters/" .. character .. "/sprites")
|
|
|
|
self.sprite:changeAnimation(animationName, true)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CharAnimViewer:update(dt)
|
|
|
|
if (love.keyboard.isDown("z") and (not self.menusystem.isActive)) then
|
|
|
|
self.menusystem:activate()
|
|
|
|
end
|
|
|
|
if (self.sprite ~= nil) then
|
|
|
|
self.sprite:update(dt)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function CharAnimViewer:setBackground(newBackground)
|
|
|
|
self.background = Background(self, 5, 1, newBackground)
|
|
|
|
end
|
|
|
|
|
|
|
|
function CharAnimViewer:draw()
|
|
|
|
self.background:draw()
|
|
|
|
if (self.sprite ~= nil) then
|
|
|
|
self.sprite:drawAnimation(424/2, 240/1.5)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return CharAnimViewer
|