28 lines
892 B
Lua
28 lines
892 B
Lua
score = {
|
|
points = 0,
|
|
color = 28,
|
|
zoom = 1,
|
|
surf = nil,
|
|
|
|
init = function()
|
|
score.points = 0
|
|
score.surf = surf.load("sprites.gif")
|
|
end,
|
|
|
|
draw = function()
|
|
draw.rectf(0,0,160,8,1)
|
|
draw.text(string.format("%03d", score.points),1,1,score.color)
|
|
surf.source(score.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,
|
|
|
|
inc = function(value)
|
|
print("score.inc()")
|
|
score.points = score.points + value
|
|
tweening.add(8, 0, 0.5, easing.linear, function(val,progress,finished) score.color = (math.floor(val)&1) == 0 and 28 or 14 end)
|
|
end
|
|
}
|