- Reestructuració completa
This commit is contained in:
26
data/modules/score.lua
Normal file
26
data/modules/score.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
score = {
|
||||
points = 0,
|
||||
color = 28,
|
||||
zoom = 1,
|
||||
surf = nil,
|
||||
} local me = score
|
||||
|
||||
function me.init()
|
||||
me.points = 0
|
||||
me.surf = surf.load("gfx/sprites.gif")
|
||||
end
|
||||
|
||||
function me.draw()
|
||||
draw.rectf(0,0,160,8,1)
|
||||
draw.text(string.format("%03d", me.points),1,1,me.color)
|
||||
surf.source(me.surf)
|
||||
if sprites.hero.keys["verda"] then draw.surf(16,48,16,8, 32,-1) end
|
||||
if sprites.hero.keys["groga"] then draw.surf(16,56,16,8, 32,-1) end
|
||||
if sprites.hero.keys["roja"] then draw.surf(32,48,16,8, 32,-1) end
|
||||
if sprites.hero.keys["blava"] then draw.surf(32,56,16,8, 32,-1) end
|
||||
end
|
||||
|
||||
function me.inc(value)
|
||||
me.points = me.points + value
|
||||
tweening.add(8, 0, 0.5, easing.linear, function(val,progress,finished) me.color = (math.floor(val)&1) == 0 and 28 or 14 end)
|
||||
end
|
||||
Reference in New Issue
Block a user