feat: add more content to the battle finished screen

This commit is contained in:
Kazhnuz 2020-08-06 16:37:06 +02:00
parent 8421b8ae97
commit d9237b9383
7 changed files with 93 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,6 @@
return {
metadata = {
height = 27,
width = 27,
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -4,6 +4,7 @@ return {
{"normaltiles", "assets/backgrounds/normaltile"}, {"normaltiles", "assets/backgrounds/normaltile"},
{"sptiles", "assets/backgrounds/specialtile"}, {"sptiles", "assets/backgrounds/specialtile"},
{"borders", "assets/backgrounds/borders"}, {"borders", "assets/backgrounds/borders"},
{"ranks", "assets/gui/ranks"}
}, },
["sprites"] = { ["sprites"] = {
{"cursorground", "assets/gui/cursor/ground"}, {"cursorground", "assets/gui/cursor/ground"},
@ -13,6 +14,7 @@ return {
["textures"] = { ["textures"] = {
{"menucursor", "assets/gui/cursor-menulist.png"}, {"menucursor", "assets/gui/cursor-menulist.png"},
{"statusbar", "assets/gui/status_bar.png"}, {"statusbar", "assets/gui/status_bar.png"},
{"expbar", "assets/gui/expbar.png"},
{"cursorpeak", "assets/gui/cursor/peak.png"}, {"cursorpeak", "assets/gui/cursor/peak.png"},
{"actorsShadow", "assets/sprites/shadow.png"}, {"actorsShadow", "assets/sprites/shadow.png"},
{"emptytile", "assets/backgrounds/tilemask.png"}, {"emptytile", "assets/backgrounds/tilemask.png"},
@ -39,6 +41,8 @@ return {
["imagefonts"] = { ["imagefonts"] = {
{"hudnbrs", "assets/gui/fonts/hudnumbers"}, {"hudnbrs", "assets/gui/fonts/hudnumbers"},
{"hudnbrs_small", "assets/gui/fonts/hudsmallnumbers"}, {"hudnbrs_small", "assets/gui/fonts/hudsmallnumbers"},
{"SA2font", "assets/gui/fonts/SA2font"},
{"sadv", "assets/gui/fonts/sadv"}
}, },
["sfx"] = { ["sfx"] = {
{"hit", "assets/sfx/hit.wav"}, {"hit", "assets/sfx/hit.wav"},

View file

@ -7,11 +7,13 @@ local BATTLECOMPLETE_STOP = 4
local gui = require "game.modules.gui" local gui = require "game.modules.gui"
local tw, th = 280, 64 local tw, th = 280+48, 64
local rankWidth, rankHeight = 64, 48
function VictoryScreen:new(scene) function VictoryScreen:new(scene)
self.scene = scene self.scene = scene
self.assets = scene.assets self.assets = scene.assets
self.turnSystem = scene.turns
self.tweens = TweenManager(self) self.tweens = TweenManager(self)
@ -25,11 +27,34 @@ function VictoryScreen:new(scene)
self.tweens:newTween(0, 0.6, {labelOpacity=1}, 'inExpo') self.tweens:newTween(0, 0.6, {labelOpacity=1}, 'inExpo')
self.tweens:newTween(0.9, 0.4, {labelY=32}, 'inExpo') self.tweens:newTween(0.9, 0.4, {labelY=32}, 'inExpo')
self.textBox = gui.newTextBox("assets/gui/dialogbox.png", tw, th) self.infoBox = self:createInfoBox()
self.rankBox = gui.newTextBox("assets/gui/dialogbox.png", rankWidth, rankHeight)
self.tbSize = 0.6 self.tbSize = 0.6
self.tbOpacity = 0 self.tbOpacity = 0
self.tweens:newTween(1.4, 0.4, {tbSize=1, tbOpacity=1}, 'inExpo') self.tweens:newTween(1.4, 0.4, {tbSize=1, tbOpacity=1}, 'inExpo')
self.rankOpacity = 0
self.rankSize = 4
self.tweens:newTween(1.9, 0.4, {rankSize=1, rankOpacity=1}, 'inExpo')
end
function VictoryScreen:createInfoBox()
local textBox = gui.newTextBox("assets/gui/dialogbox.png", tw, th)
local canvas = love.graphics.newCanvas(tw, th)
love.graphics.setCanvas(canvas)
love.graphics.draw(textBox, 0, 0)
self.assets.fonts["SA2font"]:print("ENNEMIES:", 6, 6)
self.assets.fonts["SA2font"]:print(self.turnSystem.ennemies:count(), tw - 6, 6, "right")
self.assets.fonts["SA2font"]:print("COMBOS:", 6, th - 6 - 22)
self.assets.fonts["SA2font"]:print("0/0", tw - 6, th - 6 - 22, "right")
love.graphics.setCanvas()
local imagedata = canvas:newImageData()
local texture = love.graphics.newImage( imagedata )
imagedata:release()
canvas:release()
return texture
end end
function VictoryScreen:update(dt) function VictoryScreen:update(dt)
@ -37,19 +62,66 @@ function VictoryScreen:update(dt)
end end
function VictoryScreen:draw() function VictoryScreen:draw()
love.graphics.setColor(0, 0, 0, self.vignetteOpacity)
local width, height = core.screen:getDimensions() local width, height = core.screen:getDimensions()
love.graphics.rectangle("fill", 0, 0, width, height) self:drawVignette(width, height)
self:drawLabel(width/2, self.labelY, self.labelOpacity)
love.graphics.setColor(1, 1, 1, self.labelOpacity) self:drawInfobox(width/2, height/2 - 32, self.tbSize, self.tbOpacity)
local w, h = self.assets.images["battlecompleted"]:getDimensions()
self.assets.images["battlecompleted"]:draw(width/2, self.labelY, 0, 1, 1, w/2, h/2)
--love.graphics.setColor(1, 1, 1, self.tbOpacity) local startx = (width/2 - tw/2)
--love.graphics.draw(self.textBox, width/2, height/2 - 32, 0, self.tbSize, self.tbSize, tw/2, th/2) local endx = (width/2 + tw/2)
local scorex = startx + rankWidth + 8
local starty = height/2 + 8
local endy = starty + rankHeight
self:drawRankBox(startx, starty, self.rankSize, self.tbOpacity, self.rankOpacity)
self:drawText(scorex, starty, endx, "EXP:", "+999", self.tbOpacity)
self:drawText(scorex, endy - 24, endx, "RINGS:", "+999", self.tbOpacity)
for i,character in ipairs(self.turnSystem.player.list) do
self:drawCharacterExp(startx + ((i-1)*84), endy + 8, character, self.tbOpacity)
end
utils.graphics.resetColor() utils.graphics.resetColor()
end end
function VictoryScreen:drawVignette(width, height)
love.graphics.setColor(0, 0, 0, self.vignetteOpacity)
love.graphics.rectangle("fill", 0, 0, width, height)
end
function VictoryScreen:drawLabel(x, y, opacity)
love.graphics.setColor(1, 1, 1, opacity)
local w, h = self.assets.images["battlecompleted"]:getDimensions()
self.assets.images["battlecompleted"]:draw(x, y, 0, 1, 1, w/2, h/2)
end
function VictoryScreen:drawInfobox(x, y, size, opacity)
love.graphics.setColor(1, 1, 1, opacity)
love.graphics.draw(self.infoBox, x, y, 0, size, size, tw/2, th/2)
end
function VictoryScreen:drawRankBox(x, y, rankSize, boxOpacity, rankOpacity)
love.graphics.setColor(1, 1, 1, boxOpacity)
love.graphics.draw(self.rankBox, x, y)
love.graphics.setColor(1, 1, 1, rankOpacity)
self.assets.tileset["ranks"]:drawTile(1, x + (rankWidth/2), y + (rankHeight/2), 0, rankSize, rankSize, 13, 13)
end
function VictoryScreen:drawText(x, y, x2, text1, text2, opacity)
love.graphics.setColor(1, 1, 1, opacity)
self.assets.fonts["SA2font"]:print(text1, x, y)
self.assets.fonts["SA2font"]:print(text2, x2, y, "right")
end
function VictoryScreen:drawCharacterExp(x, y, character, opacity)
love.graphics.setColor(1, 1, 1, opacity)
self.assets.images["expbar"]:draw(x, y)
character:drawIcon(x+1, y+6)
love.graphics.setColor(0, 0.8, 0.1, opacity)
gui.drawBar(x + 22, y + 11, 56, 7)
end
return VictoryScreen return VictoryScreen