Hi,
is it possible to display time on screen.
If yes, please give example.
Thanks.
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Hi,
is it possible to display time on screen.
If yes, please give example.
Thanks.
hope this helps
1 2 3 4 5 6 7 8 | local timeTable,timetxt local function displayTime() timeTable = os.date("*t") if timetxt then timetxt:removeSelf() end timetxt = display.newText(timeTable.hour..":"..timeTable.min..":"..timeTable.sec,50,50,nil,20) end timer.performWithDelay(1000,displayTime,0) |
Thanks.
It's displaying system date and time but I want to assign 30 second time (in reverse order) in my apps and if time is become 0 then I want some activity.
Thanks.
you may use this.
1 2 3 4 5 6 7 8 9 10 11 12 | local remainingTime = 10 local timer1 local timedisplay = display.newText("Time :"..remainingTime,50,50,nil,25) local function timeChange() remainingTime = remainingTime - 1 timedisplay.text = "Time :"..remainingTime if remainingTime == 0 then print("Do Something") timer.cancel(timer1) end end timer1 = timer.performWithDelay(1000,timeChange,0) |
did a stupidity in the first code that I posted. I can't delete it also. it can be re written like this.
1 2 3 4 5 6 7 8 | local timeTable local timetxt = display.newText("Time :",150,150,nil,25) local function displayTime() timeTable = os.date("*t") timetxt.text = timeTable.hour..":"..timeTable.min..":"..timeTable.sec end timer.performWithDelay(1000,displayTime,0) <lua> |
Thanks.