Implement path drawing effect

This commit is contained in:
Quinn
2021-12-27 12:35:44 -08:00
parent 56942461e7
commit 7bab9c56f9
3 changed files with 34 additions and 16 deletions
+7 -2
View File
@@ -2,6 +2,7 @@ ball = {
__count = 0,
id = nil,
pos = vec2:new(0,0),
last_pos = vec2:new(0,0),
vel = vec2:new(0,0),
rad = 1,
col = 7,
@@ -10,11 +11,15 @@ ball = {
return self.rad
end,
draw = function(self)
draw = function(self, shadow)
if (shadow == true) then
circfill(self.last_pos.x, self.last_pos.y, self.rad, self.col + 8)
end
circfill(self.pos.x, self.pos.y, self.rad, self.col)
end,
move = function(self)
self.last_pos = self.pos
self.pos += self.vel
end,
@@ -53,7 +58,7 @@ function ball:new(o)
ball.__count += 1
local o = o or {}
o.id = ball.__count
o.col = o.col or o.id % 16
o.col = o.col or o.id % 8
setmetatable(o, self)
o.__index = self
return o