Hi,
can someone tell me how to properly add scores inside of an enterFrame function?
like:
1 2 3 4 5 6 7 | local function foo() if var == 1 then scorevar = scorevar + 100 end end Runtime:addEventListener("enterFrame", foo) |
timer.performWithDelay(1, foo, 1)
A timer that only performs once after 1/1000 of a second. :D
For many games, you get points when you do something. But @IKink's idea is good for the games where you get points for time based things, like points for surviving.....
The other way is to keep track of the number of frames, lets say your a 30 fps app, try something like this in your :
1 2 3 4 5 6 7 8 9 | local frameCount = 0 local function foo() frameCount = frameCount + 1 if frameCount > 30 then scorevar = scorevar + 100 frameCount = 0 end end Runtime:addEventListener("enterFrame", foo) |
i need something different i think
i have this:
1 2 3 4 5 6 7 8 9 10 11 12 | if t[many].part1.health >= 100 and t[many].part2.health >= 100 and t[many].part3.health >= 100 then t[many].part1Complete = true t[many].part2Complete = true t[many].part3Complete = true astroScore = astroScore + 300 shipScore = shipScore + 300 scoreTextField.score = scoreTextField.score + 300 scoreTextField.text = string.format("SCORE: %05d", scoreTextField.score) end |
Last time I use something like this to check every secound is level up:
1 2 3 4 5 6 7 8 9 10 | local increaseLevel = function() local round = math.ceil if ( round ( Points / 1000 ) > level ) then level = level + 1 ... end end timer1 = timer.performWithDelay(1000, increaseLevel, 0) |
views:1351 update:2011/12/1 20:56:45
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
Notification Center in iOS5
finding freelance / contract work
Coremidi support
READ_PHONE_STATE change?
Cavern Drake - First In-App Purchase Enabled App - Ready for Sale (FREE)
event.phase == "ended" is being missed during fast swipe and release
Who made this particle emitter? Can't find the thread/code exchange/url for it.
Director Class and Modules / external files
Not able to reauthorize Corona SDK on Mac
Game Edition Alpha 3 Is Now Available
finding freelance / contract work
Coremidi support
READ_PHONE_STATE change?
Cavern Drake - First In-App Purchase Enabled App - Ready for Sale (FREE)
event.phase == "ended" is being missed during fast swipe and release
Who made this particle emitter? Can't find the thread/code exchange/url for it.
Director Class and Modules / external files
Not able to reauthorize Corona SDK on Mac
Game Edition Alpha 3 Is Now Available
corona forums © 2003-2011