improvement: rework frame
This commit is contained in:
parent
65174322fd
commit
294d2699e7
5 changed files with 27 additions and 10 deletions
21
sonic-bluestreak.love/game/modules/gui/frame.lua
Normal file
21
sonic-bluestreak.love/game/modules/gui/frame.lua
Normal 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
|
|
@ -2,6 +2,8 @@ local cwd = (...):gsub('%.player$', '') .. "."
|
|||
local Parent = require(cwd .. "parent")
|
||||
local Player = Parent:extend()
|
||||
|
||||
local Frame = require("game.modules.gui.frame")
|
||||
|
||||
function Player:new(world, x, y, z, id)
|
||||
Player.super.new(self, world, "player", x, y, 0, 16, 12, 24, true)
|
||||
self:setGravity(480*2)
|
||||
|
@ -9,9 +11,7 @@ function Player:new(world, x, y, z, id)
|
|||
self:setSprite("sonic", 8, 10)
|
||||
self:cloneSprite()
|
||||
|
||||
self.guiborder = game.gui.newBorder(424, 20, 6)
|
||||
self.emblem = love.graphics.newImage("assets/gui/status/emblem_speedster.png")
|
||||
self.status = love.graphics.newImage("assets/gui/status/status_bar.png")
|
||||
self.frame = Frame()
|
||||
|
||||
self.action = "normal"
|
||||
end
|
||||
|
@ -91,9 +91,7 @@ function Player:draw()
|
|||
end
|
||||
|
||||
function Player:drawHUD(id)
|
||||
love.graphics.draw(self.guiborder, 424, 20, 0, -1, -1)
|
||||
love.graphics.draw(self.emblem, 8, 8, 0)
|
||||
love.graphics.draw(self.status, 24, 16, 0)
|
||||
self.frame:draw()
|
||||
end
|
||||
|
||||
return Player
|
||||
|
|
|
@ -17,7 +17,7 @@ function RadianceWorld:createMapController()
|
|||
customMap.Battle(self, self.maptype, self.mapname)
|
||||
elseif (self.maptype == "shoot") then
|
||||
customMap.Shoot(self, self.maptype, self.mapname)
|
||||
self.cameras:lockY(4)
|
||||
self.cameras:lockY(10)
|
||||
else
|
||||
RadianceWorld.super.createMapController(self)
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ local BattleMap = BaseMap:extend()
|
|||
|
||||
function BattleMap:new(world, maptype, mapname)
|
||||
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.mappath = game.utils.getMapPath(maptype, mapname)
|
||||
|
||||
|
|
|
@ -91,7 +91,6 @@ function ShootMap:addParallax(filename)
|
|||
filename = backfolder .. filename
|
||||
self.texture.back1 = love.graphics.newImage(filename .. "-back.png")
|
||||
self.texture.back2 = love.graphics.newImage(filename .. "-fore.png")
|
||||
self.texture.cliff = love.graphics.newImage(filename .. "-cliff.png")
|
||||
end
|
||||
|
||||
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 - 100)
|
||||
self:drawCliff(x, y - 110, w, h)
|
||||
end
|
||||
|
||||
function ShootMap:drawBackground(x, y, w, h)
|
||||
|
|
Loading…
Reference in a new issue