improvement: rework frame

This commit is contained in:
Kazhnuz 2019-12-28 13:54:57 +01:00
parent 65174322fd
commit 294d2699e7
5 changed files with 27 additions and 10 deletions

View file

@ -0,0 +1,21 @@
local Frame = Object:extend()
function Frame:new()
self.guiborder = game.gui.newBorder(424, 20, 6)
self.guiborder2 = game.gui.newBorder(424, 40, 12)
self.emblem = love.graphics.newImage("assets/gui/status/emblem_speedster.png")
self.status = love.graphics.newImage("assets/gui/status/status_bar.png")
end
function Frame:draw()
love.graphics.setColor(0.256, 0.632, 0.852, 1)
love.graphics.rectangle("fill", 0, 220, 424, 20)
utils.graphics.resetColor()
love.graphics.draw(self.guiborder, 424, 20, 0, -1, -1)
love.graphics.draw(self.guiborder2, 424, 220, 0, 1, 1, 424, 0)
love.graphics.draw(self.emblem, 8, 8, 0)
love.graphics.draw(self.status, 24, 16, 0)
end
return Frame

View file

@ -2,6 +2,8 @@ local cwd = (...):gsub('%.player$', '') .. "."
local Parent = require(cwd .. "parent") local Parent = require(cwd .. "parent")
local Player = Parent:extend() local Player = Parent:extend()
local Frame = require("game.modules.gui.frame")
function Player:new(world, x, y, z, id) function Player:new(world, x, y, z, id)
Player.super.new(self, world, "player", x, y, 0, 16, 12, 24, true) Player.super.new(self, world, "player", x, y, 0, 16, 12, 24, true)
self:setGravity(480*2) self:setGravity(480*2)
@ -9,9 +11,7 @@ function Player:new(world, x, y, z, id)
self:setSprite("sonic", 8, 10) self:setSprite("sonic", 8, 10)
self:cloneSprite() self:cloneSprite()
self.guiborder = game.gui.newBorder(424, 20, 6) self.frame = Frame()
self.emblem = love.graphics.newImage("assets/gui/status/emblem_speedster.png")
self.status = love.graphics.newImage("assets/gui/status/status_bar.png")
self.action = "normal" self.action = "normal"
end end
@ -91,9 +91,7 @@ function Player:draw()
end end
function Player:drawHUD(id) function Player:drawHUD(id)
love.graphics.draw(self.guiborder, 424, 20, 0, -1, -1) self.frame:draw()
love.graphics.draw(self.emblem, 8, 8, 0)
love.graphics.draw(self.status, 24, 16, 0)
end end
return Player return Player

View file

@ -17,7 +17,7 @@ function RadianceWorld:createMapController()
customMap.Battle(self, self.maptype, self.mapname) customMap.Battle(self, self.maptype, self.mapname)
elseif (self.maptype == "shoot") then elseif (self.maptype == "shoot") then
customMap.Shoot(self, self.maptype, self.mapname) customMap.Shoot(self, self.maptype, self.mapname)
self.cameras:lockY(4) self.cameras:lockY(10)
else else
RadianceWorld.super.createMapController(self) RadianceWorld.super.createMapController(self)
end end

View file

@ -3,7 +3,7 @@ local BattleMap = BaseMap:extend()
function BattleMap:new(world, maptype, mapname) function BattleMap:new(world, maptype, mapname)
BattleMap.super.new(self, world) BattleMap.super.new(self, world)
self:setPadding(0, 128, 0, 0) self:setPadding(0, 128, 0, 20)
self.directory = game.utils.getMapDirectory(maptype, mapname) self.directory = game.utils.getMapDirectory(maptype, mapname)
self.mappath = game.utils.getMapPath(maptype, mapname) self.mappath = game.utils.getMapPath(maptype, mapname)

View file

@ -91,7 +91,6 @@ function ShootMap:addParallax(filename)
filename = backfolder .. filename filename = backfolder .. filename
self.texture.back1 = love.graphics.newImage(filename .. "-back.png") self.texture.back1 = love.graphics.newImage(filename .. "-back.png")
self.texture.back2 = love.graphics.newImage(filename .. "-fore.png") self.texture.back2 = love.graphics.newImage(filename .. "-fore.png")
self.texture.cliff = love.graphics.newImage(filename .. "-cliff.png")
end end
function ShootMap:drawParallax(x, y, w, h) function ShootMap:drawParallax(x, y, w, h)
@ -106,7 +105,6 @@ function ShootMap:drawParallax(x, y, w, h)
self:drawBorder(x, y + 10) self:drawBorder(x, y + 10)
self:drawBorder(x, y - 100) self:drawBorder(x, y - 100)
self:drawCliff(x, y - 110, w, h)
end end
function ShootMap:drawBackground(x, y, w, h) function ShootMap:drawBackground(x, y, w, h)