I commented the lines and now it doesn’t give an error but:
The reference point is wrong.
When it switches scene and you got back to it, the time text jumps away and it is there for more than 3 seconds.
[code]
module(…, package.seeall)
function new()
local localGroup = display.newGroup()
kolon = display.newText(":", 50,50, system.defaultFont, 50)
kolon:setTextColor(250,250,250)
kolon:setReferencePoint(display.CenterReferencePoint)
kolon.x = display.contentWidth/2
kolon.y = display.contentHeight/1.24
localGroup:insert(kolon)
secondsPast = 0
minutesPast = 0
seconds = display.newText(secondsPast,50,50,system.defaultFont, 50)
seconds:setReferencePoint(display.CenterLeftReferencePoint)
seconds.x = kolon.x + 12
seconds.y = display.contentHeight/1.24
localGroup:insert(seconds)
minutes = display.newText(minutesPast,50,50,system.defaultFont, 50)
minutes:setReferencePoint(display.CenterRightReferencePoint)
minutes.x = kolon.x - 12
minutes.y = display.contentHeight/1.24
localGroup:insert(minutes)
function secondsEffect()
if seconds.y then
transition.to(seconds,{time=100, y=seconds.y-40 })
transition.to(seconds,{time=100, delay=50, y=seconds.y})
end
end
function minutesEffect()
if minutes.y then
transition.to(minutes,{time=100, y=minutes.y-40 })
transition.to(minutes,{time=100, delay=50, y=minutes.y})
end
end
function printTime()
secondsEffect()
secondsPast = secondsPast+1
if secondsPast == 60 then
minutesEffect()
minutesPast = minutesPast+1
secondsPast = 0
end
seconds.text = secondsPast
– seconds:setReferencePoint(display.CenterLeftReferencePoint)
seconds.x = display.contentWidth/2 + 12
minutes.text = minutesPast
– minutes:setReferencePoint(display.CenterRightReferencePoint)
minutes.x = display.contentWidth/2 - 12
end
function startTimer()
timer.performWithDelay( 1000, printTime, 0)
end
function onTimer()
director:changeScene(“mainmenu”)
end
timer.performWithDelay( 3000, onTimer,1)
startTimer()
return localGroup
end
[/code] [import]uid: 24111 topic_id: 12559 reply_id: 45942[/import]