Hello again to fellow corona users
i’ve declare “local score = 0” and add some score to it by button and i need to fire some function if score reaches, lets say, 5…
here is my code, reckon what i did wrong… its seems to be easy, but i think i missed something
[lua]local score = 0
local btn = display.newRect(150,150,30,30)
local function addscore(event)
if(event.phase == “ended”) then
score = score + 1
end
end
function iffive()
if score > 5 then
print(“5”)
end
end
btn:addEventListener(“touch”, addscore)
iffive()[/lua]
any help appreciated
[import]uid: 16142 topic_id: 12418 reply_id: 312418[/import]
. Haha [import]uid: 17138 topic_id: 12418 reply_id: 45314[/import]
[import]uid: 3826 topic_id: 12418 reply_id: 45336[/import]