Steps for competiting:
- You copy the following code into a new project.
- You run the project, placing your iPad on the floor in a room with much space.
- You do push ups - but warning - they only count when your nose touches the iPad!
- If you want, you can share your results!
-- Push Ups
function setup()
--- AMOUNT OF PUSH UPS ---
n = 0
--- SYSTEM DATA - TOUCH, DISPLAY, ... ---
touching = false
col = color(72, 189, 64, 255) -- You can change this.
displayMode(FULLSCREEN)
--- SECURITY OF ACCIDENTAL DOUBLE TOUCH ---
pauseNeeded = 50 -- You can change this.
pause = pauseNeeded
canDoNext = true
--- GIVE UP ---
letterList = {}
local DEMOTIVATION = "Give up!"
for x = 1, #DEMOTIVATION do
table.insert(letterList, Letter(string.sub(DEMOTIVATION, x, x), WIDTH*.5+(x-#DEMOTIVATION/2)*25, HEIGHT*.1))
end
--- MOTIVATING STRINGS EVERY N PUSH UPS ---
motivationStrings = {"Come on! You can do it!", "Don't give up! One more!", "You're not done yet!", "You just started!", "The crowd applouses...", "You didn't even become red, yet!!", "We trust in you!"} -- You can change this.
pushUpsForMotivation = 5 -- You can change this.
motivationID = 1
end
function draw()
fill(col)
background(0)
if touching then
rect(0, 0, WIDTH, HEIGHT)
end
if n > 0 then
fontSize(85)
font("AmericanTypewriter")
text(n, WIDTH*.5, HEIGHT*.5)
for a, b in ipairs(letterList) do
b:draw()
end
if n%pushUpsForMotivation == 0 then
font("SourceSansPro-Regular")
text(motivationStrings[motivationID], WIDTH*.5, HEIGHT*.35)
else
motivationID = math.random(1, pushUpsForMotivation)
end
end
if not canDoNext then
pause = pause - 1
if pause < 0 then
canDoNext = true
end
end
end
function touched(t)
if t.state == BEGAN then
touching = true
elseif t.state == ENDED then
if t.y < HEIGHT*.2 then
setup()
return
end
touching = false
if canDoNext then
n = n + 1
canDoNext = false
pause = pauseNeeded
end
end
end
Letter = class()
function Letter:init(letter, x, y)
self.string = letter
self.pos = vec2(x, y)
self.fontSize = 50 -- You can change this
self.rotRandom = math.random(1, 10)
self.xRandom = math.random(1, 10)
self.yRandom = math.random(1, 10)
end
function Letter:draw()
fontSize(self.fontSize)
font("GillSans")
ROTATION = 15*math.sin(ElapsedTime*self.rotRandom*n/10)
X_MODIFIER = 15*math.sin(ElapsedTime*self.xRandom*n/10)
Y_MODIFIER = 15*math.sin(ElapsedTime*self.yRandom*n/10)
translate(self.pos.x + X_MODIFIER, self.pos.y + Y_MODIFIER)
rotate(ROTATION)
text(self.string, 0, 0)
rotate(-ROTATION)
translate(-self.pos.x - X_MODIFIER, -self.pos.y - Y_MODIFIER)
end
https://i.imgur.com/2uoUYv5.jpg
https://i.imgur.com/c3BjGD5.jpg
You can develop the project to your own new game!
Of course, be pleased to share your score, but pay attention, if you release a picture with your face, it cannot be undone!