I use this for a countdown timer for my game, just change the value of obj.text:
module(…, package.seeall)
–Setup Groups
local localGroup = display.newGroup()
–Init Variables
local timeLimit = 10
–Display Objects
local timeLimitText = display.newText(tostring(timeLimit), 0, 0, sysFont, 25)
local function showTime(event)
timeLimit = timeLimit - 1
timeLimitText.text = tostring(timeLimit)
if timeLimit == 0 then
checkItems()
end
end
local function initVars()
–Insert Objects into Group
localGroup:insert(timeLimitText)
–Start Level
local function startLevel(event)
–Listeners
local checkTime = timer.performWithDelay(1000, showTime, timeLimit)
end
–Clean Function
function clean(event)
print(“Cleaned”)
end
function new()
–Init Varaibles
initVars()
–Return localGroup to Director Class
return localGroup
end [import]uid: 11809 topic_id: 7467 reply_id: 26442[/import]