local love = love local scores = {} local highScores = {} function scores.OnImpact( tick, isHitSuccessful ) local score = 0 if isHitSuccessful then scores.streak = scores.streak + 1 else table.insert( scores.streaks, scores.streak) scores.streak = 0 end for i, streak in ipairs( scores.streaks ) do score = score + streak * streak end scores.score = score / math.pow( tick / 120.0, 1.5 ) scores.t = tick end function scores.Reset() scores.score = 0 scores.streak = 0 scores.streaks = {} end function scores.Get() end function scores.Save() local i = 1 for j = 1, #highScores do i = j if highScores[j] < scores.score then break end end table.insert( highScores, i ) end function scores.LoadHighScores() end function scores.RenderHighScores() love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.printf( "Streak:."..scores.score, 0, 0, -1, "center" ) love.graphics.printf( "Score:."..scores.score, 0, 0, -1, "center" ) love.graphics.printf( string.format( "time:\t%.2f\nstreak:\t%d\nscore:%.2f", scores.t / 120.0, scores.streak, scores.score):gsub( "%.", "," ), 0, 0.5 * love.graphics.getHeight() - 2.0* love.graphics.getFont():getHeight(), love.graphics.getWidth(), "center" ) end return scores