2021-08-21 17:00:42 +02:00
|
|
|
local Scene = require "game.scenes"
|
2021-08-15 16:26:05 +02:00
|
|
|
local menu = require "scenes.menus.debugmenus.animation.menu"
|
2021-07-04 11:43:46 +02:00
|
|
|
|
|
|
|
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
|
2021-08-15 16:26:05 +02:00
|
|
|
menu.commons.SceneWidget(self, "MainMenu", scenes.menus.main, "Back")
|
2021-07-04 11:43:46 +02:00
|
|
|
|
|
|
|
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
|
2021-08-21 17:05:49 +02:00
|
|
|
self.sprite:draw(424/2, 240/1.5)
|
2021-07-04 11:43:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return CharAnimViewer
|