Created
October 28, 2014 16:11
-
-
Save pastagatsan/f431613f1228b6586710 to your computer and use it in GitHub Desktop.
Accuracy test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local x = 0 | |
local points = 0 | |
local presses = 0 | |
function love.update(dt) | |
x = x + 1 | |
end | |
function love.draw() | |
love.graphics.print("X: ".. x .. " PRESSES: ".. presses .. " | POINTS: ".. points, 100, 100) | |
love.graphics.print("ACCURACY: ".. ((points / presses) * 100).. "%", 100, 200) | |
if x < 30 then | |
love.graphics.print("[P] Go for a perfect!", 0, 0) | |
end | |
if x == 60 then | |
x = 0 | |
end | |
end | |
function love.keypressed(key) | |
if key == "return" then | |
presses = presses + 1 | |
if x > 57 or x < 3 then | |
if x == 60 then | |
points = points + 2 | |
else | |
points = points + 1 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment