Here's a simple one-player version of Pong for Mini Micro!
clear
// prepare the ball sprite
ball = new Sprite
ball.image = file.loadImage("/sys/pics/Block.png")
ball.scale = 0.5
ball.x = 480; ball.y = 320
ball.dx = -10; ball.dy = rnd * 10 - 5
display(4).sprites.push ball
// prepare the paddle
paddle = new Sprite
paddle.image = file.loadImage("/sys/pics/Block4.png")
paddle.scale = 0.5; paddle.rotation = 90
paddle.x = 30; paddle.y = 320
display(4).sprites.push paddle
// main loop
lost = false
score = 0
while ball.x > -30
// update the ball (including bounce off top/bottom)
ball.x = ball.x + ball.dx
ball.y = ball.y + ball.dy
if ball.y < 10 or ball.y > 630 then ball.dy = -ball.dy
// update the paddle
inp = key.pressed("left shift") - key.pressed("left ctrl")
paddle.y = paddle.y + inp * 10
// check for ball hitting paddle or back wall
if ball.x < paddle.x + 30 and not lost then
if abs(ball.y - paddle.y) < 75 then
ball.dx = -ball.dx // bounce off the paddle
ball.dy = ball.dy + rnd * 6 - 3
else
lost = true // missed the paddle; game is lost
end if
else if ball.x > 930 then
ball.dx = -ball.dx - 1 // bounce off back wall
ball.dy = ball.dy + rnd * 6 - 3
score = score + 1
text.row = 25; print score
end if
yield
end while
I used left shift and left control as the controls, rather than just using input.axis("Vertical"), because I was thinking you might want to make it into a 2-player game (with the second player using right shift and right control).
If anybody does try that, please tell us about it here!