Compare commits
No commits in common. "62bc32c97a8ddca109b3fc3a44e6cafe60e41f93" and "7e24a44617733b16abc659fd0a6048ac423da24a" have entirely different histories.
62bc32c97a
...
7e24a44617
7 changed files with 8 additions and 59 deletions
12
main.lua
12
main.lua
|
|
@ -31,18 +31,6 @@ 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 = {.8,.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(COLORS.default)
|
love.graphics.setColor(255, 255, 255, 255)
|
||||||
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(COLORS.collision)
|
love.graphics.setColor(1, 0.4, 0.4)
|
||||||
self.collider:draw()
|
self.collider:draw()
|
||||||
love.graphics.setColor(COLORS.debug)
|
love.graphics.setColor(0.4, 1, 0.4)
|
||||||
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(COLORS.default)
|
love.graphics.setColor(1, 1, 1)
|
||||||
love.graphics.circle('line', self.x, self.y, self.w)
|
love.graphics.circle('line', self.x, self.y, self.w)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,17 +42,11 @@ end
|
||||||
function Projectile:draw()
|
function Projectile:draw()
|
||||||
Projectile.super.draw(self)
|
Projectile.super.draw(self)
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
love.graphics.setColor(COLORS.collision)
|
love.graphics.setColor(1, 0, 0)
|
||||||
self.collider:draw()
|
self.collider:draw()
|
||||||
end
|
end
|
||||||
love.graphics.setColor(COLORS.default)
|
love.graphics.setColor(1, 1, 1)
|
||||||
love.graphics.circle('fill', self.x, self.y, self.s)
|
love.graphics.circle('fill', self.x, self.y, self.s)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Kills Projectile
|
|
||||||
function Projectile:kill()
|
|
||||||
self.area:addGameObject('ProjectileDeathEffect', self.x, self.y, {w = self.s*3})
|
|
||||||
self:destroy()
|
|
||||||
end
|
|
||||||
|
|
||||||
return Projectile
|
return Projectile
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
---@class ProjectileDeathEffect:GameObject
|
|
||||||
local ProjectileDeathEffect = GameObject:extend()
|
|
||||||
|
|
||||||
function ProjectileDeathEffect:new(area, x, y, opts)
|
|
||||||
ProjectileDeathEffect.super.new(self, area, x, y, opts)
|
|
||||||
-- width
|
|
||||||
self.w = opts.w or 12
|
|
||||||
self.first = true
|
|
||||||
self.timer:after(0.1, function()
|
|
||||||
self.first = false
|
|
||||||
self.second = true
|
|
||||||
self.timer:after(0.15, function()
|
|
||||||
self.second = false
|
|
||||||
self:kill()
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
---Updates ProjectileDeathEffect
|
|
||||||
---@param dt number delta time
|
|
||||||
function ProjectileDeathEffect:update(dt)
|
|
||||||
ProjectileDeathEffect.super.update(self, dt)
|
|
||||||
end
|
|
||||||
|
|
||||||
---Draws ProjectileDeathEffect
|
|
||||||
function ProjectileDeathEffect:draw()
|
|
||||||
ProjectileDeathEffect.super.draw(self)
|
|
||||||
if self.first then love.graphics.setColor(COLORS.default)
|
|
||||||
elseif self.second then love.graphics.setColor(COLORS.hp) end
|
|
||||||
love.graphics.rectangle('fill', self.x - self.w/2, self.y - self.w/2, self.w, self.w)
|
|
||||||
end
|
|
||||||
|
|
||||||
return ProjectileDeathEffect
|
|
||||||
|
|
@ -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(COLORS.default)
|
love.graphics.setColor(1,1,1)
|
||||||
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(COLORS.default)
|
love.graphics.setColor(1, 1, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
return CircleRoom
|
return CircleRoom
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue