heres a small game I made inspired by three points:

touch to rotate the square and make sure the colored balls hit the matching colored sides.

```
-- Four Points
displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT)
function setup()
colors = { color(0, 99, 255, 255), color(162, 0, 255, 255), color(234, 189, 70, 255), color(79, 232, 79, 255) }
target = { size = WIDTH / 5, angle = 0, x = WIDTH / 2, y = HEIGHT / 4 }
makeTargetImage()
maxBallSpeed = 12
ballSize = WIDTH / 20
sounds = {
rotate = function() sound("Game Sounds One:Whoosh 1") end,
score = function() sound("Game Sounds One:Bell 2") end
}
reset()
end
function makeTargetImage()
local tmesh = mesh()
local lb, rb, rt, lt, c = vec2(0, 0), vec2(target.size, 0), vec2(target.size, target.size), vec2(0, target.size), vec2(target.size / 2, target.size / 2)
tmesh.vertices = { lt, c, rt, rt, c, rb, rb, c, lb, lb, c, lt }
local mcolors = {}
for i = 1, #colors do
for v = 1, 3 do
table.insert(mcolors, colors[i])
end
end
tmesh.colors = { unpack(mcolors) }
target.image = image(target.size, target.size) setContext(target.image)
tmesh:draw()
setContext()
end
function reset()
score = 0
if target.rotating then
tween.stop(target.rotating)
target.rotating = nil
end
target.angle = 0
balls = {}
ballSpeed = 6
spawnBall()
end
function spawnBall()
local ball = { y = HEIGHT + ballSize / 2, col = math.random(1, #colors) }
table.insert(balls, ball)
end
function draw()
background(255, 255, 255, 255)
-- Balls
local topCol = specialModulo(math.ceil(((target.angle % 360) / 90) + 1), 4)
for i = #balls, 1, -1 do
local ball = balls[i]
ball.y = ball.y - ballSpeed
fill(colors[ball.col]) noStroke()
ellipse(WIDTH / 2, ball.y, ballSize)
if ball.y <= HEIGHT / 2 and not ball.spawned then
spawnBall()
ball.spawned = true
end
if ball.y <= target.y + target.size / 2 then
if ball.col == topCol then
score = score + 1
ballSpeed = math.min(ballSpeed + 0.2, maxBallSpeed)
table.remove(balls, i)
sounds.score()
else
reset()
end
end
end
-- Square
pushMatrix()
translate(target.x, target.y)
rotate(target.angle)
sprite(target.image)
popMatrix()
-- Score
fill(127) font("HelveticaNeue-CondensedBold") fontSize(WIDTH / 10)
text(score, WIDTH / 2, HEIGHT - fontSize())
fontSize(WIDTH / 20)
text("tap to rotate", WIDTH / 2, (target.y - target.size / 2) / 2)
end
function touched(t)
if t.state == ENDED then
if target.rotating then
tween.stop(target.rotating)
target.angle = target.rotating.target.angle
end
target.rotating = tween(0.1, target, { angle = target.angle + 90 })
sounds.rotate()
end
end
-- Same as a % b, except that if a is a multiple b it returns b not 0
function specialModulo(a, b)
local mod = b * (a/b - math.floor(a/b))
if mod == 0 then
mod = b
end
return mod
end
```

EDIT: Fixed a bug with it turning wrong after a restart, added a max speed for the balls