parent
58264e2a19
commit
5d34f55b23
6 changed files with 30 additions and 27 deletions
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 6 KiB |
|
@ -102,7 +102,7 @@ function ParallaxBackground:generateFloor(tile)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ParallaxBackground:draw()
|
function ParallaxBackground:draw()
|
||||||
self:drawParallax(0, -self:getStartY(), 424, 240)
|
self:drawParallax(-maputils.CONST.STARTX, -self:getStartY(), 424, 240)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ParallaxBackground:drawParallax(x, y, w, h)
|
function ParallaxBackground:drawParallax(x, y, w, h)
|
||||||
|
|
|
@ -37,8 +37,8 @@ function StatusBar:draw(x, y)
|
||||||
local hpmax = self.stats.hpmax
|
local hpmax = self.stats.hpmax
|
||||||
local ppmax = self.stats.ppmax
|
local ppmax = self.stats.ppmax
|
||||||
|
|
||||||
local bar1 = math.floor((self.hp/self.stats.hpmax)*107)
|
local bar1 = math.floor((self.hp/self.stats.hpmax)*58)
|
||||||
local bar2 = math.floor((self.pp/self.stats.ppmax)*108)
|
local bar2 = math.floor((self.pp/self.stats.ppmax)*58)
|
||||||
|
|
||||||
love.graphics.setColor(248/255, 160/255, 0, 1)
|
love.graphics.setColor(248/255, 160/255, 0, 1)
|
||||||
gui.drawBar(x+29, y+5, bar1, 7)
|
gui.drawBar(x+29, y+5, bar1, 7)
|
||||||
|
@ -56,7 +56,7 @@ function StatusBar:draw(x, y)
|
||||||
lvl = "0" .. lvl
|
lvl = "0" .. lvl
|
||||||
end
|
end
|
||||||
|
|
||||||
love.graphics.print(lvl, x+122, y-5)
|
love.graphics.print(lvl, x+73, y-5)
|
||||||
end
|
end
|
||||||
|
|
||||||
return StatusBar
|
return StatusBar
|
||||||
|
|
|
@ -9,7 +9,7 @@ local POSITIONS = {3, 1, 5}
|
||||||
local HEROES_LINE = 2;
|
local HEROES_LINE = 2;
|
||||||
|
|
||||||
local HUDBASE = 8
|
local HUDBASE = 8
|
||||||
local HUDSEP = 152
|
local HUDSIZE = 91
|
||||||
|
|
||||||
function HeroFighter:new(owner, character, id)
|
function HeroFighter:new(owner, character, id)
|
||||||
self.name = character
|
self.name = character
|
||||||
|
@ -44,7 +44,7 @@ function HeroFighter:getAbstract()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroFighter:createActor()
|
function HeroFighter:createActor()
|
||||||
local x, y = HEROES_LINE, POSITIONS[self.id]
|
local x, y = HEROES_LINE, ((self.id-1)*(4/(#game.characters.team-1))+1)
|
||||||
return self.world.obj.Hero(self.world, x, y, self)
|
return self.world.obj.Hero(self.world, x, y, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -152,9 +152,10 @@ function HeroFighter:drawIcon(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroFighter:drawHUD()
|
function HeroFighter:drawHUD()
|
||||||
local x = HUDBASE + (self.id-1)*HUDSEP
|
local boxSize = 424 / 4
|
||||||
|
local x = (self.id-0.5)*boxSize
|
||||||
local y = self.turnSystem.hud:getPlayerHUDPosition()
|
local y = self.turnSystem.hud:getPlayerHUDPosition()
|
||||||
self.statusbar:draw(x, y)
|
self.statusbar:draw(x - HUDSIZE/2, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
return HeroFighter
|
return HeroFighter
|
||||||
|
|
|
@ -3,6 +3,8 @@ local HUD = Object:extend()
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
local TweenManager = require "game.modules.tweenmanager"
|
local TweenManager = require "game.modules.tweenmanager"
|
||||||
|
|
||||||
|
local PLAYER_HUD_HIDDEN = 240+64
|
||||||
|
local PLAYER_HUD_VISIBLE = 240-44
|
||||||
|
|
||||||
function HUD:new(turns)
|
function HUD:new(turns)
|
||||||
self.turns = turns
|
self.turns = turns
|
||||||
|
@ -13,7 +15,7 @@ function HUD:new(turns)
|
||||||
self.frame = gui.newBorder(424, 30, 4)
|
self.frame = gui.newBorder(424, 30, 4)
|
||||||
self.tweens = TweenManager(self)
|
self.tweens = TweenManager(self)
|
||||||
|
|
||||||
self.playerHUDPosition = -64
|
self.playerHUDPosition = PLAYER_HUD_HIDDEN
|
||||||
self.battlerCursor = self.turns.turns.current
|
self.battlerCursor = self.turns.turns.current
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,9 +25,9 @@ end
|
||||||
|
|
||||||
function HUD:movePlayerHUD(beginBattle)
|
function HUD:movePlayerHUD(beginBattle)
|
||||||
if (beginBattle) then
|
if (beginBattle) then
|
||||||
self.tweens:newTween(0, 0.4, {playerHUDPosition = 16}, 'inCubic')
|
self.tweens:newTween(0, 0.4, {playerHUDPosition = PLAYER_HUD_VISIBLE}, 'inCubic')
|
||||||
else
|
else
|
||||||
self.tweens:newTween(0, 0.4, {playerHUDPosition = -64}, 'inCubic')
|
self.tweens:newTween(0, 0.4, {playerHUDPosition = PLAYER_HUD_HIDDEN}, 'inCubic')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,22 +40,9 @@ function HUD:getPlayerHUDPosition()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HUD:draw()
|
function HUD:draw()
|
||||||
for i, action in ipairs(self.turns.actionList) do
|
local x, y = 4, 5
|
||||||
if action.fighter:canFight() then
|
|
||||||
action.fighter:drawIcon(4 + (i-1)*(20), 216)
|
|
||||||
else
|
|
||||||
self:drawEmptyIcon(4 + (i-1)*(20), 216)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local cursorx = self.battlerCursor * 20 - 8
|
|
||||||
|
|
||||||
if #self.turns.actionList > 0 then
|
love.graphics.draw(self.frame, 0, 24, 0, 1, -1)
|
||||||
self.assets.images["menucursor"]:draw(cursorx, 216, math.rad(90), 1, 1, 4, 8)
|
|
||||||
end
|
|
||||||
|
|
||||||
local x, y = 362, 225
|
|
||||||
|
|
||||||
love.graphics.draw(self.frame, 424, 220, 0, -1, 1)
|
|
||||||
self.assets.images["hudturn"]:draw(x, y)
|
self.assets.images["hudturn"]:draw(x, y)
|
||||||
self.assets.fonts["hudnbrs"]:set()
|
self.assets.fonts["hudnbrs"]:set()
|
||||||
local turnnbr = self.turns.turns.number
|
local turnnbr = self.turns.turns.number
|
||||||
|
@ -61,6 +50,19 @@ function HUD:draw()
|
||||||
turnnbr = "0" .. turnnbr
|
turnnbr = "0" .. turnnbr
|
||||||
end
|
end
|
||||||
love.graphics.print(turnnbr, x + 33, y + 1)
|
love.graphics.print(turnnbr, x + 33, y + 1)
|
||||||
|
|
||||||
|
for i, action in ipairs(self.turns.actionList) do
|
||||||
|
if action.fighter:canFight() then
|
||||||
|
action.fighter:drawIcon(76 + (i-1)*(20), 5)
|
||||||
|
else
|
||||||
|
self:drawEmptyIcon(76 + (i-1)*(20), 5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local cursorx = (self.battlerCursor-1) * 20 + 76
|
||||||
|
|
||||||
|
if #self.turns.actionList > 0 then
|
||||||
|
self.assets.images["menucursor"]:draw(cursorx, 5, math.rad(90), 1, 1, 4, 16)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function HUD:drawEmptyIcon(x, y)
|
function HUD:drawEmptyIcon(x, y)
|
||||||
|
|
|
@ -10,7 +10,7 @@ local SubMenuWidget = BattleWidget:extend()
|
||||||
local BackMenuWidget = BattleWidget:extend()
|
local BackMenuWidget = BattleWidget:extend()
|
||||||
local SkillWidget = BattleWidget:extend()
|
local SkillWidget = BattleWidget:extend()
|
||||||
|
|
||||||
local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 96, 32, 96
|
local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 88, 32, 72
|
||||||
local MENU_WIDTH, MENU_ITEM_HEIGHT = 180, 17
|
local MENU_WIDTH, MENU_ITEM_HEIGHT = 180, 17
|
||||||
local MENU_ITEM_NUMBER = 6
|
local MENU_ITEM_NUMBER = 6
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue