summaryrefslogtreecommitdiffhomepage
path: root/not/Ray.lua
blob: 4ae640abeb3d2caf9e3596f98b188d696f8a8605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- That awesome effect that blinks when player dies!
Ray = require "not.Object":extends()

function Ray:new (source, world)
	self.source = source
	self.world = world
	self.delay = 0.3
end

function Ray:update (dt)
	self.delay = self.delay - dt
	if self.delay < 0 then
		return true -- delete
	end
	return false
end

-- TODO: Ray should use Camera boundaries just-in-case.
-- TODO: Ray uses magic numbers.
function Ray:draw ()
	love.graphics.setColor(255, 247, 228, 247)
	love.graphics.setLineStyle("rough")
	love.graphics.setLineWidth(self.delay*160)

	local x, y = self.source:getPosition()

	love.graphics.line(x, y, -x, -y)
end

return Ray