Ok, I’m working on a mildly simple app for a presentational marketing piece for work. It’s using the “Samurai Fruit” as the basis for the app to get me started. It’s not for retail - simply a prototype to use at a conference to get attention to our booth.
So I have it edited and changed so it works and looks more unique to our company. I wanted to add a timer so people who are really good with Fruit Ninja style apps don’t stand there for ages playing one round of the game.
So I came across a nice little script over at www.techority.com
I made it a module, attached it to my main.lau and it works. Timer bar draws down.
But, obviously, it doesn’t end the game.
So I’m trying my best to figure out how to get it to end … I just want to at this point when the bar gets to the end say “Times up”. I can figure out how to get it to go to the end screen later. One step at a time, ya know?
So here is my code. I get no errors - but the if statement at the end doesn’t do squat …
I’m a LUA noob … so I apologize if the answer is staring me in the faca with bright, blinking LED lights shining at me.
[code]
– Timer
–Show a basic white bar
local timeBar = display.newRect( 20, 165, 280, 20 )
timeBar:setReferencePoint(display.BottomLeftReferencePoint)
timeBar.x = 20
timeBar.y = 40
–Make the bar shrink over time
local function loseTime (event)
timeBar.width = timeBar.width - 2
timeBar:setReferencePoint(display.BottomLeftReferencePoint)
timeBar.x = 20
end
gameTimer = timer.performWithDelay(5,loseTime, 0)
if(gameTimer == 0) then
textObject = display.newText( “Times Up!”, 50, 50, nil, 24 )
textObject:setTextColor( 255, 0, 0 )
end
[/code] [import]uid: 97023 topic_id: 16352 reply_id: 316352[/import]
