Join the list

Berglet / make

Make.

A Berglet game is a short text file. The editor is a web page your console serves. There's nothing to install, plug in or set up, so you can start tonight.

a Try it here

main.lua / main.py
-- The first game: a ship that moves when you hold left or right.
ship = sprite(images.ship)
ship.x = 140
ship.y = 

function update()                 -- 60 times a second
  if held(buttons.left) then ship.x = ship.x -  end
  if held(buttons.right) then ship.x = ship.x +  end
  if pressed(buttons.a) then play(sounds.laser) end

  clear(colors.)              -- then the picture
  ship:draw()
end
# The first game: a ship that moves when you hold left or right.
ship = sprite(images.ship)
ship.x = 140
ship.y = 


def update():                     # 60 times a second
    if held(buttons.left):
        ship.x -= 
    if held(buttons.right):
        ship.x += 
    if pressed(buttons.a):
        play(sounds.laser)

    clear(colors.)            # then the picture
    ship.draw()
The starter game that comes with Berglet, all of it. Change a yellow value, then click the console and use the arrow keys. Z is the A button.
YXBA SELECTSTART

Try it right here. This little console is a stand-in that runs in your browser, without sound. On Berglet, your code runs on the console itself, and the editor shows its screen live beside your code.

b How it works

Scan. Type. Save. Share.

  1. On Berglet, choose “Edit on a computer”.

    Pick a game to change, or start a new one from the starter above. The console shows a QR code and a short address.

  2. Open it in a browser.

    Laptop, tablet, a school Chromebook: anything on the same Wi-Fi. Your files stay on the console's memory card. No account, no download, no cloud.

  3. Type, then save.

    Your change lands in the game while it runs. The ship stays where it was; it just moves faster now. Made a mistake? The game keeps going, and the editor points to the line.

  4. Send it to a friend.

    From the game's page, send it to a console nearby. It shows up in their library, ready to play.

c The editor

Berglet Studio, in your browser

It looks like the editors programmers use, because it is one, with the scary parts left out.

  • The console's screen, live, beside your code. Your keyboard works its buttons.
  • Pick, don't spell. Type colors. and choose a colour. Type images. and see your pictures. Nothing to remember, nothing to misspell.
  • Drag files in. Drop a picture or a sound on the window and it becomes images.ship or sounds.laser.
  • Help right beside you: a first-game walk-through, a reference, and 38 “How do I…” recipes.
  • Problems explained in plain sentences, before you even run the game.
The editor in a browser: a file list on the left, Lua code for the Catch example in the middle, and on the right the console's screen with a star falling toward an orange box, on-screen buttons, and the first-game tutorial.
Berglet Studio with the Catch example open.

d The building blocks

Simple tools. No magic.

Every command does one clear thing, and nothing happens in your game that your code didn't say. A sprite is a picture and a place. You write the three lines that make it fall, so you know exactly why it falls.

No strings to remember, either: colors.navy, buttons.left, images.ship, sounds.coin. The editor offers them as you type.

What you can use:

  • Pictures, shapes, text and a camera; sprites that turn and resize
  • Buttons: held and pressed
  • Sounds: built-in ones and your own
  • Time: every and after
  • Rooms drawn with letters, seen from above or from inside
  • Simple 3D models
  • saved: values that are still there tomorrow, like a best score
  • web: ask the internet something, like a joke
  • nearby: talk to consoles in the same room

The same names in Lua and in Python.

examples/catch
-- Catch the stars before the time runs out.
player = sprite(images.box, 140, 220)
star = sprite(images.star, 100, 0)
score = 0
seconds_left = 30

-- every() calls a function again and again: here once a second
clock = every(1, function()
  seconds_left = seconds_left - 1
  if seconds_left == 0 then clock:cancel() end
end)

function update()
  if seconds_left > 0 then               -- the rules, while there is time
    if held(buttons.left) then player.x = player.x - 3 end
    if held(buttons.right) then player.x = player.x + 3 end
    player.x = clamp(player.x, 8, 272)   -- never off the screen

    star.y = star.y + 2
    local caught = star:touches(player)
    if caught then
      score = score + 1
      play(sounds.coin)
    end
    if caught or star.y > 250 then       -- caught or missed: it starts again at the top
      star.x = random(10, 270)
      star.y = 0
    end
  elseif pressed(buttons.a) then         -- time is up: A plays again
    game.restart()
  end

  -- then the picture
  clear(colors.navy)
  star:draw()
  player:draw()
  text("Score " .. score, 6, 4)
  text(seconds_left, 274, 4, { align = sides.right })
  if seconds_left == 0 then
    text("Time is up!", 140, 100, { align = sides.center, size = sizes.big })
    text("A: play again", 140, 130, { align = sides.center })
  end
end
# Catch the stars before the time runs out.
player = sprite(images.box, 140, 220)
star = sprite(images.star, 100, 0)
score = 0
seconds_left = 30


def tick():
    global seconds_left
    seconds_left -= 1
    if seconds_left == 0:
        clock.cancel()


# every() calls a function again and again: here once a second
clock = every(1, tick)


def update():
    global score
    if seconds_left > 0:                   # the rules, while there is time
        if held(buttons.left):
            player.x -= 3
        if held(buttons.right):
            player.x += 3
        player.x = clamp(player.x, 8, 272)     # never off the screen

        star.y += 2
        caught = star.touches(player)
        if caught:
            score += 1
            play(sounds.coin)
        if caught or star.y > 250:         # caught or missed: it starts again at the top
            star.x = random(10, 270)
            star.y = 0
    elif pressed(buttons.a):               # time is up: A plays again
        game.restart()

    # then the picture
    clear(colors.navy)
    star.draw()
    player.draw()
    text("Score %d" % score, 6, 4)
    text(seconds_left, 274, 4, align=sides.right)
    if seconds_left == 0:
        text("Time is up!", 140, 100, align=sides.center, size=sizes.big)
        text("A: play again", 140, 130, align=sides.center)
A whole game: the Catch example, as it comes with Berglet. It's the one playing on the front page.

e Pick your language

Lua or Python

The best place to start, with the same commands in both. Pick the one your teacher, your friend or your stubbornness prefers.

C, or anything that compiles to WebAssembly

For experienced programmers who want more speed. Each game runs in its own safe space, with its own files and memory.

The whole machine

A game can also be written in C with full access to the hardware. That's on the Go deeper page.