describe what you want, type it, it runs. tap a starter to load it.
MOVE & DRAW
move player with arrows
draw sprite "hero" at x, y
draw circle at 64, 64 size 20 in red
draw rect at 10, 10 size 8, 8 in green
write "score {score}" at 2, 2 in white on hud
clear screen to dark blue
VALUES & MATH
score is 0
add 10 to score
reverse ball.dx (flip sign)
x is -8 (negatives ok)
if score is 100 ...
if x > 10 and y < 5 ...
LOOPS & FUNCTIONS
repeat 10 times ...
repeat with i from 1 to 5 ...
each enemy in enemies ...
every 30 frames ...
to NAME ... (define)
NAME (call it)
SPRITES
player is centered sprite {image: "hero"}
coins is list of 8 sprites {image: "coin"}
sprite "blob" is "<64 hex>" (or use 🧹)
draw sprite player.image at player.x, player.y
SOUND
play sound "pickup" (18 built in)
play music "theme" · stop music
define sound "zap" as square from 900 to 100 over 0.1
song "tune" at 120 bpm "#..." ... (or use ♪)
COLLISION
walls are solid · coins are pickups
enemies are hostile · spikes are deadly
when player picks up any coin ...
when player hits any enemy ...
MOTION (platformer)
gravity is 0.4
jump player (upward impulse)
knock player away from enemy distance 16
INPUT
when "space" is pressed ...
when mouse is clicked ...
if key "left" ... (held)
up down left right space enter
SCREENS & BUTTONS
mode is "title"
to screen title ...
show button "play" at 40, 50
when button "play" is clicked go to play
go to X · go back
THE GAME LOOP
to update ... (runs each frame)
to draw ... (draws each frame)
run game with update and draw
Colors: black, dark blue, dark green, brown, white, red, orange, yellow, green, blue, indigo, pink, peach & more. Comments start with
--. Full reference & tutorials:
codeonline.io/docsMade by
Kevin Long (LinkedIn).