-
Notifications
You must be signed in to change notification settings - Fork 24
/
emancipationfizzle.lua
31 lines (25 loc) · 813 Bytes
/
emancipationfizzle.lua
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
31
emancipationfizzle = class:new()
function emancipationfizzle:init(x, y, speedx, speedy)
self.x = x
self.y = y
self.r = math.random()*math.pi*2
self.rotspeed = (math.random()-.5)*2
self.speedx = speedx+(math.random()-.5)*1
self.speedy = speedy+(math.random()-.5)*1
self.timer = 0
end
function emancipationfizzle:update(dt)
self.x = self.x + self.speedx*dt
self.y = self.y + self.speedy*dt
self.r = self.r + self.rotspeed*dt
self.timer = self.timer + dt
if self.timer > emancipationfizzletime then
return true
end
return false
end
function emancipationfizzle:draw()
local delta = 1-self.timer/emancipationfizzletime
love.graphics.setColor(delta, delta, delta, delta)
love.graphics.draw(fizzleimg, (self.x-xscroll)*16*scale, (self.y-yscroll-.5)*16*scale, self.r, scale, scale, 2, 1)
end