← codeonline.io

Projects

Build a whole game, step by step. Each one opens a working starter in the editor โ€” run it, then follow the “make it yours” steps. Every demo on the home page is also a template: open it and read the code.

๐Ÿช™ Catch

beginner learn: input, falling things, a score.

paddle is {x: 60}
coin is {x: 64, y: 0}
score is 0
to update
  if key "left" paddle.x is paddle.x - 3
  if key "right" paddle.x is paddle.x + 3
  coin.y is coin.y + 2
  if coin.y > 124
    coin.x is 8 + random 112
    coin.y is 0
to draw
  clear screen to dark blue
  draw rect at paddle.x, 120 size 16, 4 in white
  draw circle at coin.x, coin.y size 4 in yellow
  write "catch the coins! {score}" at 6, 4 in white on hud
run game with update and draw
Make it yours:

โ˜„๏ธ Dodge

beginner learn: avoidance, respawning obstacles.

player is {x: 64}
rock is {x: 30, y: 0}
to update
  if key "left" player.x is player.x - 3
  if key "right" player.x is player.x + 3
  rock.y is rock.y + 2
  if rock.y > 128
    rock.x is 8 + random 112
    rock.y is 0
to draw
  clear screen to black
  draw rect at rock.x, rock.y size 6, 6 in red
  draw circle at player.x, 118 size 6 in green
  write "dodge the rocks!" at 30, 4 in white on hud
run game with update and draw
Make it yours:

๐Ÿš€ Shooter

intermediate learn: shooting, projectiles, lists.

ship is {x: 64}
bullets is []
bullets are projectiles
when "space" is pressed
  b is sprite {x: ship.x, y: 110, dx: 0, dy: -1, speed: 3}
  add b to bullets
to update
  if key "left" ship.x is ship.x - 2
  if key "right" ship.x is ship.x + 2
to draw
  clear screen to dark blue
  draw rect at ship.x, 116 size 8, 6 in white
  each b in bullets
    draw rect at b.x, b.y size 2, 4 in yellow
  write "press space to shoot" at 18, 4 in white on hud
run game with update and draw
Make it yours:

๐ŸŽจ Paint

beginner learn: the mouse, building a list, creativity.

dots is []
when mouse is clicked
  d is {x: mouse.x, y: mouse.y}
  add d to dots
to draw
  clear screen to black
  each d in dots
    draw circle at d.x, d.y size 4 in pink
  write "tap to paint!" at 36, 4 in white on hud
run game with update and draw
Make it yours:

More templates

Want a Snake, a platformer, or a multiplayer game? Open the matching demo on the home page โ€” Snake, Pitfall Hop, Tag โ€” read its code, and remix it. Teachers: see the lesson plans.

codeonline.io โ€” learn to code by making games, in plain English.