add global color palette table
This commit is contained in:
parent
7e24a44617
commit
e7b1e7e78a
6 changed files with 20 additions and 8 deletions
12
main.lua
12
main.lua
|
|
@ -31,6 +31,18 @@ Area = require 'obj/Area'
|
||||||
GameObject = require 'obj/GameObject'
|
GameObject = require 'obj/GameObject'
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
|
-- table of color palette
|
||||||
|
COLORS = {
|
||||||
|
default = {1,1,1,1},
|
||||||
|
bg = {.05,.05,.05,1},
|
||||||
|
ammo = {1,1,1,1},
|
||||||
|
boost = {1,1,1,1},
|
||||||
|
hp = {1,1,1,1},
|
||||||
|
skill_point = {1,1,1,1},
|
||||||
|
collision = {1,0.4,0.4,1},
|
||||||
|
debug = {0.4,1,0.4,1}
|
||||||
|
}
|
||||||
|
|
||||||
-- screen setup
|
-- screen setup
|
||||||
love.graphics.setDefaultFilter("nearest")
|
love.graphics.setDefaultFilter("nearest")
|
||||||
love.graphics.setLineStyle("rough")
|
love.graphics.setLineStyle("rough")
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ function Room:draw()
|
||||||
end
|
end
|
||||||
love.graphics.setCanvas()
|
love.graphics.setCanvas()
|
||||||
|
|
||||||
love.graphics.setColor(255, 255, 255, 255)
|
love.graphics.setColor(COLORS.default)
|
||||||
love.graphics.setBlendMode('alpha', 'premultiplied')
|
love.graphics.setBlendMode('alpha', 'premultiplied')
|
||||||
love.graphics.draw(self.main_canvas, 0, 0, 0, sx, sy)
|
love.graphics.draw(self.main_canvas, 0, 0, 0, sx, sy)
|
||||||
love.graphics.setBlendMode('alpha')
|
love.graphics.setBlendMode('alpha')
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,12 @@ end
|
||||||
function Player:draw()
|
function Player:draw()
|
||||||
Player.super.draw(self)
|
Player.super.draw(self)
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
love.graphics.setColor(1, 0.4, 0.4)
|
love.graphics.setColor(COLORS.collision)
|
||||||
self.collider:draw()
|
self.collider:draw()
|
||||||
love.graphics.setColor(0.4, 1, 0.4)
|
love.graphics.setColor(COLORS.debug)
|
||||||
love.graphics.line(self.x, self.y, self.x + 2*self.w*math.cos(self.r), self.y + 2*self.w*math.sin(self.r))
|
love.graphics.line(self.x, self.y, self.x + 2*self.w*math.cos(self.r), self.y + 2*self.w*math.sin(self.r))
|
||||||
end
|
end
|
||||||
love.graphics.setColor(1, 1, 1)
|
love.graphics.setColor(COLORS.default)
|
||||||
love.graphics.circle('line', self.x, self.y, self.w)
|
love.graphics.circle('line', self.x, self.y, self.w)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@ end
|
||||||
function Projectile:draw()
|
function Projectile:draw()
|
||||||
Projectile.super.draw(self)
|
Projectile.super.draw(self)
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
love.graphics.setColor(1, 0, 0)
|
love.graphics.setColor(COLORS.collision)
|
||||||
self.collider:draw()
|
self.collider:draw()
|
||||||
end
|
end
|
||||||
love.graphics.setColor(1, 1, 1)
|
love.graphics.setColor(COLORS.default)
|
||||||
love.graphics.circle('fill', self.x, self.y, self.s)
|
love.graphics.circle('fill', self.x, self.y, self.s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ end
|
||||||
function ShootEffect:draw()
|
function ShootEffect:draw()
|
||||||
ShootEffect.super.draw(self)
|
ShootEffect.super.draw(self)
|
||||||
pushRotateScale(self.x, self.y, self.player.r+math.pi/4)
|
pushRotateScale(self.x, self.y, self.player.r+math.pi/4)
|
||||||
love.graphics.setColor(1,1,1)
|
love.graphics.setColor(COLORS.default)
|
||||||
love.graphics.rectangle('fill', self.x - self.w/2, self.y - self.w/2, self.w, self.w)
|
love.graphics.rectangle('fill', self.x - self.w/2, self.y - self.w/2, self.w, self.w)
|
||||||
love.graphics.pop()
|
love.graphics.pop()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ end
|
||||||
|
|
||||||
function CircleRoom:canvasDraw()
|
function CircleRoom:canvasDraw()
|
||||||
CircleRoom.super.canvasDraw(self)
|
CircleRoom.super.canvasDraw(self)
|
||||||
love.graphics.setColor(1, 1, 1)
|
love.graphics.setColor(COLORS.default)
|
||||||
end
|
end
|
||||||
|
|
||||||
return CircleRoom
|
return CircleRoom
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue