feat: improve HUD and menus placement
This commit is contained in:
parent
b247e9cc96
commit
6cf1df4d5b
4 changed files with 39 additions and 17 deletions
|
@ -6,7 +6,7 @@ local SelectionSystem = require "scenes.battlesystem.controllers.fighters.system
|
|||
local actionList = require "scenes.battlesystem.controllers.fighters.systems.actions"
|
||||
|
||||
local POSITIONS = {3, 1, 5}
|
||||
local HEROES_LINE = 3;
|
||||
local HEROES_LINE = 2;
|
||||
|
||||
function HeroFighter:new(owner, character, id)
|
||||
self.name = character
|
||||
|
@ -139,7 +139,7 @@ end
|
|||
|
||||
function HeroFighter:talk(name)
|
||||
local completename = self.name .. "_" .. name
|
||||
self.assets.sfx[completename]:play()
|
||||
--self.assets.sfx[completename]:play()
|
||||
end
|
||||
|
||||
-- DRAW FUNCTIONS
|
||||
|
|
|
@ -4,7 +4,7 @@ local VillainFighter = FighterParent:extend()
|
|||
local SimpleHPBar = require "scenes.battlesystem.gui.simplehpbar"
|
||||
|
||||
local POSITIONS = {1, 3, 5}
|
||||
local ENNEMY_LINE = 10;
|
||||
local ENNEMY_LINE = 11;
|
||||
|
||||
function VillainFighter:new(owner, ennemy, id)
|
||||
self.name = ennemy
|
||||
|
|
|
@ -23,7 +23,7 @@ end
|
|||
|
||||
function HUD:movePlayerHUD(beginBattle)
|
||||
if (beginBattle) then
|
||||
self.tweens:newTween(0, 0.4, {playerHUDPosition = 36}, 'inCubic')
|
||||
self.tweens:newTween(0, 0.4, {playerHUDPosition = 16}, 'inCubic')
|
||||
else
|
||||
self.tweens:newTween(0, 0.4, {playerHUDPosition = -64}, 'inCubic')
|
||||
end
|
||||
|
@ -40,20 +40,20 @@ end
|
|||
function HUD:draw()
|
||||
for i, action in ipairs(self.turns.actionList) do
|
||||
if action.fighter:canFight() then
|
||||
action.fighter:drawIcon(4 + (i-1)*(20), 6)
|
||||
action.fighter:drawIcon(4 + (i-1)*(20), 216)
|
||||
else
|
||||
self:drawEmptyIcon(4 + (i-1)*(20), 6)
|
||||
self:drawEmptyIcon(4 + (i-1)*(20), 216)
|
||||
end
|
||||
end
|
||||
local cursorx = self.battlerCursor * 20 - 8
|
||||
|
||||
if #self.turns.actionList > 0 then
|
||||
self.assets.images["menucursor"]:draw(cursorx, 26, math.rad(-90), 1, 1, 4, 8)
|
||||
self.assets.images["menucursor"]:draw(cursorx, 216, math.rad(90), 1, 1, 4, 8)
|
||||
end
|
||||
|
||||
local x, y = 362, 3
|
||||
local x, y = 362, 225
|
||||
|
||||
love.graphics.draw(self.frame, 424, 20, 0, -1, -1)
|
||||
love.graphics.draw(self.frame, 424, 220, 0, -1, 1)
|
||||
self.assets.images["hudturn"]:draw(x, y)
|
||||
self.assets.fonts["hudnbrs"]:set()
|
||||
local turnnbr = self.turns.turns.number
|
||||
|
|
|
@ -10,8 +10,8 @@ local SubMenuWidget = BattleWidget:extend()
|
|||
local BackMenuWidget = BattleWidget:extend()
|
||||
local SkillWidget = BattleWidget:extend()
|
||||
|
||||
local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 32, 32, 110
|
||||
local MENU_WIDTH, MENU_ITEM_HEIGHT = 148, 17
|
||||
local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 96, 32, 96
|
||||
local MENU_WIDTH, MENU_ITEM_HEIGHT = 180, 17
|
||||
local MENU_ITEM_NUMBER = 6
|
||||
|
||||
function MenuConstructor:new( controller )
|
||||
|
@ -122,7 +122,27 @@ end
|
|||
|
||||
function CharacterMenu:drawCursor()
|
||||
local addition = 17
|
||||
love.graphics.draw(self.cursorTexture, self.x + 4, self.y + (self.cursorTransition) * addition )
|
||||
local x = self.x + 4 + ((self.cursorTransition) * addition * 0.5)
|
||||
local y = self.y + ((self.cursorTransition) * addition)
|
||||
love.graphics.draw(self.cursorTexture, x, y)
|
||||
end
|
||||
|
||||
function CharacterMenu:draw()
|
||||
self:updateView()
|
||||
local widgety = self.y
|
||||
local widgetx = self.x
|
||||
for i,v in ipairs(self.widget.list) do
|
||||
if (i >= self.view.firstSlot) and (i < self.view.firstSlot + self.view.slotNumber) then
|
||||
v:draw(widgetx, widgety, self.w, self.widget.h)
|
||||
if self.widget.selected == i and self:haveFocus() == true then
|
||||
v:drawSelected(widgetx, widgety, self.w, self.widget.h)
|
||||
else
|
||||
v:draw(widgetx, widgety, self.w, self.widget.h)
|
||||
end
|
||||
widgety = widgety + self.widget.h
|
||||
widgetx = widgetx + (self.widget.h/2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- WIDGETS
|
||||
|
@ -178,10 +198,12 @@ function BattleWidget:drawCanvas()
|
|||
local midAsset = love.graphics.newQuad(16, 0, 1, sh, sw, sh)
|
||||
local endAsset = love.graphics.newQuad(sw-16, 0, 16, sh, sw, sh)
|
||||
|
||||
love.graphics.draw(asset, startAsset, 0, (self.height - 13) / 2)
|
||||
love.graphics.draw(asset, endAsset, self.width-16, (self.height - 13) / 2)
|
||||
local trueWidth = self.width - 32
|
||||
|
||||
local iterations = self.width-32
|
||||
love.graphics.draw(asset, startAsset, 0, (self.height - 13) / 2)
|
||||
love.graphics.draw(asset, endAsset, trueWidth-16, (self.height - 13) / 2)
|
||||
|
||||
local iterations = trueWidth-32
|
||||
|
||||
for i=0,iterations do
|
||||
love.graphics.draw(asset, midAsset, 16+i, (self.height - 13) / 2)
|
||||
|
@ -191,10 +213,10 @@ function BattleWidget:drawCanvas()
|
|||
h = math.floor(self.height / 2) - (self.font:getHeight() / 2)
|
||||
love.graphics.setColor(0, 0, 0, .8)
|
||||
self.font:print(self.label, 17, h, "left")
|
||||
self.font:print(self.label2, self.width - 8, h, "right")
|
||||
self.font:print(self.label2, trueWidth - 8, h, "right")
|
||||
utils.graphics.resetColor()
|
||||
self.font:print(self.label, 16, h, "left")
|
||||
self.font:print(self.label2, self.width - 9, h, "right")
|
||||
self.font:print(self.label2, trueWidth - 9, h, "right")
|
||||
end
|
||||
|
||||
function BattleWidget:action()
|
||||
|
|
Loading…
Reference in a new issue