improvement(cbs): add turn counting to battle HUD
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 468 B |
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
BIN
sonic-radiance.love/assets/gui/strings/hudturn.png
Normal file
After Width: | Height: | Size: 712 B |
|
@ -22,6 +22,8 @@ return {
|
||||||
{"m_speedster", "assets/gui/emblem_speedster_mask.png"},
|
{"m_speedster", "assets/gui/emblem_speedster_mask.png"},
|
||||||
{"m_technic", "assets/gui/emblem_technic_mask.png"},
|
{"m_technic", "assets/gui/emblem_technic_mask.png"},
|
||||||
{"m_power", "assets/gui/emblem_power_mask.png"},
|
{"m_power", "assets/gui/emblem_power_mask.png"},
|
||||||
|
|
||||||
|
{"hudturn", "assets/gui/strings/hudturn.png"},
|
||||||
},
|
},
|
||||||
["fonts"] = {
|
["fonts"] = {
|
||||||
{"small", "assets/gui/fonts/PixelOperator.ttf", 16},
|
{"small", "assets/gui/fonts/PixelOperator.ttf", 16},
|
||||||
|
|
|
@ -5,14 +5,10 @@ local BattleSystem = Scene:extend()
|
||||||
local World = require "scenes.battlesystem.world"
|
local World = require "scenes.battlesystem.world"
|
||||||
local MenuSystem = require "scenes.battlesystem.menu"
|
local MenuSystem = require "scenes.battlesystem.menu"
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
|
||||||
|
|
||||||
|
|
||||||
function BattleSystem:new()
|
function BattleSystem:new()
|
||||||
BattleSystem.super.new(self)
|
BattleSystem.super.new(self)
|
||||||
|
|
||||||
self.assets:batchImport("scenes.battlesystem.assets")
|
self.assets:batchImport("scenes.battlesystem.assets")
|
||||||
self.frame = gui.newBorder(424, 30, 8)
|
|
||||||
|
|
||||||
self:initManagers()
|
self:initManagers()
|
||||||
|
|
||||||
|
@ -31,8 +27,6 @@ end
|
||||||
|
|
||||||
function BattleSystem:draw()
|
function BattleSystem:draw()
|
||||||
self.world:draw()
|
self.world:draw()
|
||||||
|
|
||||||
love.graphics.draw(self.frame, 424, 20, 0, -1, -1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleSystem:exit()
|
function BattleSystem:exit()
|
||||||
|
|
|
@ -10,6 +10,8 @@ local POSITIONS = {
|
||||||
{x = 2, y = 6},
|
{x = 2, y = 6},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local gui = require "game.modules.gui"
|
||||||
|
|
||||||
-- INIT FUNCTIONS
|
-- INIT FUNCTIONS
|
||||||
-- Initialize the battle world
|
-- Initialize the battle world
|
||||||
|
|
||||||
|
@ -24,7 +26,7 @@ function World:new(scene, battlefile)
|
||||||
|
|
||||||
self.turns = {}
|
self.turns = {}
|
||||||
self.turns.current = 1
|
self.turns.current = 1
|
||||||
self.turns.number = 1
|
self.turns.number = 0
|
||||||
self.turns.isFinished = true
|
self.turns.isFinished = true
|
||||||
self.turns.changeBattler = true
|
self.turns.changeBattler = true
|
||||||
self.battlers = {}
|
self.battlers = {}
|
||||||
|
@ -40,6 +42,7 @@ function World:new(scene, battlefile)
|
||||||
|
|
||||||
self:initHeroes()
|
self:initHeroes()
|
||||||
self:initEnnemies()
|
self:initEnnemies()
|
||||||
|
self:initHUD()
|
||||||
end
|
end
|
||||||
|
|
||||||
function World:initHeroes(battlefile)
|
function World:initHeroes(battlefile)
|
||||||
|
@ -230,6 +233,10 @@ function World:drawShadows()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function World:initHUD()
|
||||||
|
self.frame = gui.newBorder(424, 30, 4)
|
||||||
|
end
|
||||||
|
|
||||||
function World:drawHUD()
|
function World:drawHUD()
|
||||||
for i,v in ipairs(self.actionlist) do
|
for i,v in ipairs(self.actionlist) do
|
||||||
v.actor:drawIcon(4 + (i-1)*(20), 6)
|
v.actor:drawIcon(4 + (i-1)*(20), 6)
|
||||||
|
@ -241,6 +248,17 @@ function World:drawHUD()
|
||||||
for i,v in ipairs(self.battlers) do
|
for i,v in ipairs(self.battlers) do
|
||||||
v:drawHUD()
|
v:drawHUD()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local x, y = 362, 3
|
||||||
|
|
||||||
|
love.graphics.draw(self.frame, 424, 20, 0, -1, -1)
|
||||||
|
self.assets.images["hudturn"]:draw(x, y)
|
||||||
|
self.assets.fonts["hudnbrs"]:set()
|
||||||
|
local turnnbr = self.turns.number
|
||||||
|
if (turnnbr < 10) then
|
||||||
|
turnnbr = "0" .. turnnbr
|
||||||
|
end
|
||||||
|
love.graphics.print(turnnbr, x + 33, y + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|