3 Sparkle
.type = "Sparkle"
5 Sparkle
.image
, Sparkle
.w
, Sparkle
.h
= get_image("images/sparkle.png")
6 Sparkle
.fallspeed
= 0
Sparkle
.y_accel
= 0.035
7 Sparkle
.rect
= Rect
:new({x
=8, y
=8, w
=16, h
=16})
9 function Sparkle
:new(o
)
17 function Sparkle
:update(delta
)
18 Object
.update(self
, delta
)
20 self
.fallspeed
= self
.fallspeed
+ self
.y_accel
23 self
.y
= self
.y
+ self
.fallspeed
25 --bounds checking (ensure it's inside the game screen)
26 if self
.x
> s_width
or self
.y
> s_height
or self
.x
+ self
.w
< 0 or self
.y
+ self
.h
< 0 then
33 function Sparkle
:collide(ids
, object
)
34 if object
.type == "Darkle" then
35 phazon_list
:push_back(Phazon
:new({x
=self
.x
,y
=self
.y
}))
37 if object
.type == "Rectangle" then
38 dark_height
= dark_height
- 1.5
39 if dark_height
< 0 then dark_height
= 0 end
45 function Sparkle
:draw()