Make a game
This tutorial builds Firefly, a small platformer: a firefly hops across a dusky world, gathering lights and dodging thorns on the way to a lantern. Each step is a whole program that runs; on the website, "Run it in the playground" opens it in your browser, and with Sloppy installed sloppy firefly.jo runs it in a window. (The second tutorial builds an arcade game, a small version of Rebound.)
1. A window
# step 1: a window, and something in it
draw = ():
clear(rgb(0.1, 0.1, 0.18))
circle(vec2(640, 360), 16, rgb(1, 0.9, 0.5))
window("Firefly", 1280, 720)
A program with a draw function is a game: Sloppy opens the window (window gives its title and size) and calls draw 60 times a second (or as often as the screen refreshes). The screen is 1280 x 720 units whatever the window's real size; (0, 0) is the top left and y goes down.
2. Moving
# step 2: moving with the keyboard (or a gamepad)
pos = vec2(640, 360)
update = (dt: f64):
pos += input_axis() * 400 * dt
draw = ():
clear(rgb(0.1, 0.1, 0.18))
circle(pos, 16, rgb(1, 0.9, 0.5))
window("Firefly", 1280, 720)
update runs before each frame is drawn, with dt: the seconds since the last one. Moving by speed * dt makes the speed the same on every computer. input_axis() is the direction the arrow keys, WASD or a gamepad's stick point in, as a vec2 from -1 to 1.
pos is made at the top of the file, outside any function, so it is kept from one frame to the next, and update and draw both use it. (A variable first given a value inside a function belongs to that function and starts again each time it runs.)
Whole numbers (400) and numbers with a decimal point (0.5, dt) mix freely in arithmetic: 400 * dt is fine. A variable keeps the kind its first value has, though: after x = 640, x holds whole numbers, and x += 300 * dt is an error; write x = 640.0 for one that holds fractions too. Dividing two whole numbers gives a whole number (7 / 2 is 3 and 3 / 4 is 0; write 7.0 / 2 for 3.5), and a number with a decimal point becomes a whole one only when you ask: int(x).
A picture can stand in for the circle: put firefly.png next to the program, write hero = load_texture(embed("firefly.png")).unwrap() at the top (embed builds the file into the program), and sprite(hero, pos) in draw, which puts the picture's top left corner at pos.
3. Gravity and jumping
# step 3: gravity, ground and jumping
const GRAVITY = 1800.0
const JUMP = 700.0
const GROUND = 600.0
pos = vec2(640, 300)
vel = vec2(0, 0)
update = (dt: f64):
vel.x = input_axis().x * 400.0
vel.y += GRAVITY * dt
on_ground = pos.y >= GROUND
if on_ground and key_pressed(.space): vel.y = -JUMP
pos += vel * dt
if pos.y > GROUND:
pos.y = GROUND
vel.y = 0.0
draw = ():
clear(rgb(0.1, 0.1, 0.18))
rect(0, GROUND + 16.0, 1280, 120, rgb(0.2, 0.18, 0.26))
circle(pos, 16, rgb(1, 0.9, 0.5))
window("Firefly", 1280, 720)
Velocity is how far the firefly moves each second; gravity adds to it each frame, and a jump sets it to point up. key_pressed is true only in the frame a key goes down (key_down is true as long as it is held).
4. Platforms
# step 4: platforms to stand on
const GRAVITY = 1800.0
const JUMP = 700.0
const SIZE = 16.0
platforms = [
Rect(0, 616, 1280, 120), # the ground: x, y, width, height
Rect(300, 480, 200, 24),
Rect(620, 380, 200, 24),
Rect(940, 280, 200, 24),
]
pos = vec2(100, 500)
vel = vec2(0, 0)
on_ground = false
# the box the firefly takes up, when it is at p
box = (p: vec2) -> Rect: Rect(p.x - SIZE, p.y - SIZE, SIZE * 2.0, SIZE * 2.0)
blocked = (p: vec2) -> bool:
loop r in platforms:
if overlaps(box(p), r): return true
false
update = (dt: f64):
global on_ground, pos
vel.x = input_axis().x * 400.0
vel.y += GRAVITY * dt
if on_ground and key_pressed(.space): vel.y = -JUMP
# move across, then up or down, each only as far as nothing is in the way
next = pos + vec2(vel.x * dt, 0)
if not blocked(next): pos = next
next = pos + vec2(0, vel.y * dt)
on_ground = false
if blocked(next):
if vel.y > 0.0: on_ground = true
vel.y = 0.0
else: pos = next
draw = ():
clear(rgb(0.1, 0.1, 0.18))
loop r in platforms: rect(r.x, r.y, r.w, r.h, rgb(0.25, 0.22, 0.32))
circle(pos, SIZE, rgb(1, 0.9, 0.5))
window("Firefly", 1280, 720)
platforms is a list (an array) written between [ and ], and loop r in platforms: runs its lines once for each one, with r standing for it. Rect(x, y, width, height) is a rectangle (with a capital R; rect(...) draws one), and overlaps says whether two touch.
box and blocked are functions of our own. (p: vec2) is what each one is given, and -> Rect or -> bool is what it gives back (a bool is true or false). A function gives back the value on its last line, so blocked ends with false: nothing was in the way. return true gives back true at once, from the middle of the loop. The firefly moves across and then up or down, each only if nothing is in the way, so it slides along walls and lands on top of platforms. Landing is what makes on_ground true, so jumps only start from the ground.
global on_ground, pos at the start of update says that pos = next and on_ground = false change the variables at the top of the file. Without it, x = ... in a function makes a variable of the function's own (as a helper's count = 0 should), and Sloppy says so when that one is never read. vel.y += ... and vel.x = ... change what is there already, and need no global.
5. Things to collect
# step 5: lights to collect, a count, and a sound
const GRAVITY = 1800.0
const JUMP = 700.0
const SIZE = 16.0
platforms = [
Rect(0, 616, 1280, 120), # the ground: x, y, width, height
Rect(300, 480, 200, 24),
Rect(620, 380, 200, 24),
Rect(940, 280, 200, 24),
]
lights = [vec2(400, 440), vec2(720, 340), vec2(1040, 240), vec2(1180, 560)]
collected = 0
chime = sfx_chime() # a ready-made sound (also: sfx_jump, sfx_hit, tone, melody)
pos = vec2(100, 500)
vel = vec2(0, 0)
on_ground = false
# the box the firefly takes up, when it is at p
box = (p: vec2) -> Rect: Rect(p.x - SIZE, p.y - SIZE, SIZE * 2.0, SIZE * 2.0)
blocked = (p: vec2) -> bool:
loop r in platforms:
if overlaps(box(p), r): return true
false
update = (dt: f64):
global on_ground, pos
vel.x = input_axis().x * 400.0
vel.y += GRAVITY * dt
if on_ground and key_pressed(.space): vel.y = -JUMP
# move across, then up or down, each only as far as nothing is in the way
next = pos + vec2(vel.x * dt, 0)
if not blocked(next): pos = next
next = pos + vec2(0, vel.y * dt)
on_ground = false
if blocked(next):
if vel.y > 0.0: on_ground = true
vel.y = 0.0
else: pos = next
# take the lights the firefly touches
i = 0
loop i < lights.len():
if circles_overlap(pos, SIZE, lights[i], 10.0):
lights.remove_at(i)
collected += 1
play(chime)
else: i += 1
draw = ():
clear(rgb(0.1, 0.1, 0.18))
loop r in platforms: rect(r.x, r.y, r.w, r.h, rgb(0.25, 0.22, 0.32))
loop l in lights: circle(l, 8, rgb(1, 0.8, 0.4))
circle(pos, SIZE, rgb(1, 0.9, 0.5))
text("lights {collected}", vec2(24, 20), 28)
window("Firefly", 1280, 720)
circles_overlap checks whether the firefly touches a light; taken lights are removed from the array. loop i < lights.len(): repeats as long as i < lights.len() is true, and lights[i] is the light at position i (counting from 0); the position only moves on when nothing was removed, since removing one moves the next into its place. sfx_chime() makes a sound once, at the start; play plays it. text draws on the screen, and {collected} puts a value into a string.
6. A bigger world
# step 6: a bigger world, a camera that follows, and thorns
const GRAVITY = 1800.0
const JUMP = 700.0
const SIZE = 16.0
const WORLD_W = 6000.0
platforms: Rect[]
thorns: Rect[]
lights: vec2[]
collected = 0
chime = sfx_chime()
ouch = sfx_hit()
pos = vec2(100, 500)
vel = vec2(0, 0)
on_ground = false
cam = vec2(0, 0)
# a new world: stretches of ground with gaps, ledges above them, thorns and lights
make_world = ():
seed_random(7) # the same world every time
x = 0.0
loop x < WORLD_W:
w = random(400.0, 900.0)
y = 616.0 + random(-50.0, 50.0)
platforms.push(Rect(x, y, w, 400))
lights.push(vec2(x + w / 2.0, y - 40.0))
if random() < 0.7:
lx = x + random(50.0, w - 250.0)
platforms.push(Rect(lx, y - 150.0, 200, 24))
lights.push(vec2(lx + 100.0, y - 190.0))
if x > 500.0 and random() < 0.5:
thorns.push(Rect(x + w - 160.0, y - 14.0, 80, 14))
x += w + random(80.0, 200.0)
box = (p: vec2) -> Rect: Rect(p.x - SIZE, p.y - SIZE, SIZE * 2.0, SIZE * 2.0)
blocked = (p: vec2) -> bool:
loop r in platforms:
if overlaps(box(p), r): return true
false
# back to the start (the lights stay taken)
restart = ():
global pos, vel
play(ouch)
pos = vec2(100, 400)
vel = vec2(0, 0)
update = (dt: f64):
global cam, on_ground, pos
vel.x = input_axis().x * 400.0
vel.y += GRAVITY * dt
if on_ground and key_pressed(.space): vel.y = -JUMP
next = pos + vec2(vel.x * dt, 0)
if not blocked(next): pos = next
next = pos + vec2(0, vel.y * dt)
on_ground = false
if blocked(next):
if vel.y > 0.0: on_ground = true
vel.y = 0.0
else: pos = next
i = 0
loop i < lights.len():
if circles_overlap(pos, SIZE, lights[i], 10.0):
lights.remove_at(i)
collected += 1
play(chime)
else: i += 1
loop t in thorns:
if overlaps(box(pos), t): restart()
if pos.y > 1200.0: restart() # fell into a gap
# the camera eases toward the firefly
cam = approach(cam, vec2(pos.x - 640.0, 0), 5.0, dt)
draw = ():
clear(rgb(0.1, 0.1, 0.18))
push_transform()
translate(-cam.x, -cam.y) # draw the world as the camera sees it
loop r in platforms: rect(r.x, r.y, r.w, r.h, rgb(0.25, 0.22, 0.32))
loop t in thorns: rect(t.x, t.y, t.w, t.h, rgb(0.6, 0.15, 0.25))
loop l in lights: circle(l, 8, rgb(1, 0.8, 0.4))
circle(pos, SIZE, rgb(1, 0.9, 0.5))
pop_transform()
text("lights {collected}", vec2(24, 20), 28) # (after pop_transform: on the screen, not in the world)
window("Firefly", 1280, 720)
make_world()
platforms: Rect[] makes an empty array that will hold Rects (Rect[] is "an array of Rects"), and platforms.push(...) adds one at its end. The world is made by code now: stretches of ground of random widths with gaps between them, ledges above, thorns and lights. seed_random(7) makes the random numbers the same each run, so the world is too (change the 7 for another). A camera follows the firefly: translate shifts everything drawn after it, and approach eases the camera toward where it should be, so it glides instead of jerking. The count is drawn after pop_transform, so it stays put on the screen.
7. A beginning and an end
# step 7: a title screen, a goal, and a best time that is kept
build:
name = "Firefly" # (save_data keeps data under the program's name)
const GRAVITY = 1800.0
const JUMP = 700.0
const SIZE = 16.0
const WORLD_W = 6000.0
enum Screen: title, play, won
screen = Screen.title
time = 0.0
best = to_float(load_data("best") ?? "") ?? 0.0 # 0: no best time yet
platforms: Rect[]
thorns: Rect[]
lights: vec2[]
collected = 0
chime = sfx_chime()
ouch = sfx_hit()
pos = vec2(100, 500)
vel = vec2(0, 0)
on_ground = false
cam = vec2(0, 0)
# a new world: stretches of ground with gaps, ledges above them, thorns and lights
make_world = ():
seed_random(7) # the same world every time
x = 0.0
loop x < WORLD_W:
w = random(400.0, 900.0)
y = 616.0 + random(-50.0, 50.0)
platforms.push(Rect(x, y, w, 400))
lights.push(vec2(x + w / 2.0, y - 40.0))
if random() < 0.7:
lx = x + random(50.0, w - 250.0)
platforms.push(Rect(lx, y - 150.0, 200, 24))
lights.push(vec2(lx + 100.0, y - 190.0))
if x > 500.0 and random() < 0.5:
thorns.push(Rect(x + w - 160.0, y - 14.0, 80, 14))
x += w + random(80.0, 200.0)
box = (p: vec2) -> Rect: Rect(p.x - SIZE, p.y - SIZE, SIZE * 2.0, SIZE * 2.0)
blocked = (p: vec2) -> bool:
loop r in platforms:
if overlaps(box(p), r): return true
false
start = ():
global collected, pos, screen, time, vel
platforms.clear()
thorns.clear()
lights.clear()
make_world()
collected = 0
time = 0.0
pos = vec2(100, 400)
vel = vec2(0, 0)
screen = .play
# back to the start (the lights stay taken)
restart = ():
global pos, vel
play(ouch)
pos = vec2(100, 400)
vel = vec2(0, 0)
update = (dt: f64):
global best, cam, on_ground, pos, screen
if screen != .play: return
time += dt
vel.x = input_axis().x * 400.0
vel.y += GRAVITY * dt
if on_ground and key_pressed(.space): vel.y = -JUMP
next = pos + vec2(vel.x * dt, 0)
if not blocked(next): pos = next
next = pos + vec2(0, vel.y * dt)
on_ground = false
if blocked(next):
if vel.y > 0.0: on_ground = true
vel.y = 0.0
else: pos = next
i = 0
loop i < lights.len():
if circles_overlap(pos, SIZE, lights[i], 10.0):
lights.remove_at(i)
collected += 1
play(chime)
else: i += 1
loop t in thorns:
if overlaps(box(pos), t): restart()
if pos.y > 1200.0: restart() # fell into a gap
# the camera eases toward the firefly
cam = approach(cam, vec2(pos.x - 640.0, 0), 5.0, dt)
# the lantern at the end of the world
if pos.x > WORLD_W - 200.0:
if best == 0.0 or time < best:
best = time
save_data("best", "{best}")
screen = .won
draw = ():
clear(rgb(0.1, 0.1, 0.18))
push_transform()
translate(-cam.x, -cam.y) # draw the world as the camera sees it
loop r in platforms: rect(r.x, r.y, r.w, r.h, rgb(0.25, 0.22, 0.32))
loop t in thorns: rect(t.x, t.y, t.w, t.h, rgb(0.6, 0.15, 0.25))
loop l in lights: circle(l, 8, rgb(1, 0.8, 0.4))
circle(vec2(WORLD_W - 150.0, 520), 30, rgb(1, 0.7, 0.3)) # the lantern
circle(pos, SIZE, rgb(1, 0.9, 0.5))
pop_transform()
if screen == .title:
text_centered("FIREFLY", vec2(640, 200), 96)
text_centered("reach the lantern", vec2(640, 280), 28)
ui_begin("title", vec2(640, 400))
if ui_button("Play"): start()
if best > 0.0: ui_text("best {best:.1} s")
ui_end()
else:
text("lights {collected} time {time:.1}", vec2(24, 20), 28) # (after pop_transform: on the screen)
if screen == .won:
text_centered("you made it in {time:.1} s", vec2(640, 220), 56)
ui_begin("won", vec2(640, 340))
if ui_button("Again"): start()
ui_end()
window("Firefly", 1280, 720)
make_world()
An enum is a type with a few named values: screen is one of Screen.title, Screen.play and Screen.won. Where the type is already known, as when comparing with screen or giving it a new value, .play is enough. != means "is not equal to", and return on its own leaves update early: nothing moves on the title screen.
load_data("best") gives back the saved text, or none when nothing was saved yet. ?? says what to use then: load_data("best") ?? "" is the text or nothing, and to_float turns text into a number (or none again, when it is not one: hence the second ?? 0.0). In text, {best:.1} shows the number with one digit after the point.
The menus come from ui_begin and ui_button: each button is drawn every frame, and is true in the frame it is chosen (with the arrow keys and enter, a gamepad, or a click). save_data and load_data keep the best time between runs: in a file in your user folder, or in the browser's storage on the web. build: name = "Firefly" names the program, so its saved data has a place of its own.
8. Polish
# step 8: polish: glow, sparks, music
build:
name = "Firefly" # (save_data keeps data under the program's name)
const GRAVITY = 1800.0
const JUMP = 700.0
const SIZE = 16.0
const WORLD_W = 6000.0
enum Screen: title, play, won
screen = Screen.title
time = 0.0
best = to_float(load_data("best") ?? "") ?? 0.0 # 0: no best time yet
platforms: Rect[]
thorns: Rect[]
lights: vec2[]
collected = 0
chime = sfx_chime()
ouch = sfx_hit()
hop = sfx_jump()
sparks = Particles(gravity = vec2(0, 300), drag = 1.0)
music = melody("E4 - G4 B4 - A4 G4 - E4 - D4 E4 - - . . C4 - E4 G4 - F#4 E4 - B3 - C4 D4 - - . .", 90.0, .triangle, 0.15)
pos = vec2(100, 500)
vel = vec2(0, 0)
on_ground = false
cam = vec2(0, 0)
# a new world: stretches of ground with gaps, ledges above them, thorns and lights
make_world = ():
seed_random(7) # the same world every time
x = 0.0
loop x < WORLD_W:
w = random(400.0, 900.0)
y = 616.0 + random(-50.0, 50.0)
platforms.push(Rect(x, y, w, 400))
lights.push(vec2(x + w / 2.0, y - 40.0))
if random() < 0.7:
lx = x + random(50.0, w - 250.0)
platforms.push(Rect(lx, y - 150.0, 200, 24))
lights.push(vec2(lx + 100.0, y - 190.0))
if x > 500.0 and random() < 0.5:
thorns.push(Rect(x + w - 160.0, y - 14.0, 80, 14))
x += w + random(80.0, 200.0)
box = (p: vec2) -> Rect: Rect(p.x - SIZE, p.y - SIZE, SIZE * 2.0, SIZE * 2.0)
blocked = (p: vec2) -> bool:
loop r in platforms:
if overlaps(box(p), r): return true
false
start = ():
global collected, pos, screen, time, vel
platforms.clear()
thorns.clear()
lights.clear()
make_world()
collected = 0
time = 0.0
pos = vec2(100, 400)
vel = vec2(0, 0)
screen = .play
# back to the start (the lights stay taken)
restart = ():
global pos, vel
play(ouch)
pos = vec2(100, 400)
vel = vec2(0, 0)
update = (dt: f64):
global best, cam, on_ground, pos, screen
if screen != .play: return
time += dt
vel.x = input_axis().x * 400.0
vel.y += GRAVITY * dt
if on_ground and key_pressed(.space):
vel.y = -JUMP
play(hop, 0.5)
next = pos + vec2(vel.x * dt, 0)
if not blocked(next): pos = next
next = pos + vec2(0, vel.y * dt)
on_ground = false
if blocked(next):
if vel.y > 0.0: on_ground = true
vel.y = 0.0
else: pos = next
i = 0
loop i < lights.len():
if circles_overlap(pos, SIZE, lights[i], 10.0):
lights.remove_at(i)
collected += 1
play(chime)
emit(sparks, pos, 20, 250.0, rgba(1, 0.8, 0.4, 1), 0.7, 4.0)
else: i += 1
loop t in thorns:
if overlaps(box(pos), t): restart()
if pos.y > 1200.0: restart() # fell into a gap
update(sparks, dt)
# the camera eases toward the firefly
cam = approach(cam, vec2(pos.x - 640.0, 0), 5.0, dt)
# the lantern at the end of the world
if pos.x > WORLD_W - 200.0:
if best == 0.0 or time < best:
best = time
save_data("best", "{best}")
screen = .won
draw = ():
clear(rgb(0.1, 0.1, 0.18))
v = visible_rect()
rect_gradient(v.x, v.y, v.w, v.h, rgb(0.08, 0.08, 0.2), rgb(0.35, 0.2, 0.3)) # a dusk sky
push_transform()
translate(-cam.x, -cam.y) # draw the world as the camera sees it
loop r in platforms: rect(r.x, r.y, r.w, r.h, rgb(0.25, 0.22, 0.32))
loop t in thorns: rect(t.x, t.y, t.w, t.h, rgb(0.6, 0.15, 0.25))
# glows: drawn with additive blending, so light adds up
blend(.add)
loop l in lights: circle_gradient(l, 40, rgba(1, 0.7, 0.3, 0.5), rgba(1, 0.5, 0.2, 0))
circle_gradient(pos, 90, rgba(1, 0.9, 0.5, 0.5), rgba(1, 0.7, 0.3, 0))
circle_gradient(vec2(WORLD_W - 150.0, 520), 200, rgba(1, 0.7, 0.3, 0.6), rgba(1, 0.5, 0.2, 0))
blend(.alpha)
loop l in lights: circle(l, 6, rgb(1, 0.95, 0.8))
circle(vec2(WORLD_W - 150.0, 520), 26, rgb(1, 0.85, 0.6)) # the lantern
circle(pos, SIZE, rgb(1, 0.97, 0.85))
draw(sparks)
pop_transform()
if screen == .title:
text_centered("FIREFLY", vec2(640, 200), 96)
text_centered("reach the lantern", vec2(640, 280), 28)
ui_begin("title", vec2(640, 400))
if ui_button("Play"): start()
if best > 0.0: ui_text("best {best:.1} s")
ui_end()
else:
text("lights {collected} time {time:.1}", vec2(24, 20), 28) # (after pop_transform: on the screen)
if screen == .won:
text_centered("you made it in {time:.1} s", vec2(640, 220), 56)
ui_begin("won", vec2(640, 340))
if ui_button("Again"): start()
ui_end()
window("Firefly", 1280, 720)
make_world()
play(music, 0.6, looping = true)
Light that glows: blend(.add) makes colors add up instead of covering each other, and circle_gradient fades from a color in the middle to nothing at the edge. Particles are sparks that fly, slow down and fade: emit makes some, and update(sparks, dt) and draw(sparks) move and draw them (the particles' own update and draw, given the sparks; the game's are the ones with nothing before the dt or ()). melody writes music from note names, looping = true keeps it playing, and a dusk sky behind it all is one rect_gradient.
Shapes can be swapped for pictures. Put firefly.png next to the program, then:
hero = load_texture(embed("firefly.png")).unwrap() # at the top: embed builds the file into the program
# in draw, instead of the circle (sprite draws with its top left corner at the position):
draw = ():
sprite(hero, pos - vec2(SIZE, SIZE), vec2(SIZE * 2.0, SIZE * 2.0))
Pixel art wants a small screen scaled up: window("Firefly", 320, 180) and pixel_art() under it make a 2D unit one pixel, scaled up sharp by a whole number; pictures stay sharp, shapes are whole pixels in exactly their colors (no smoothed edges between a palette's colors) and text draws in a pixel font. The game's numbers (speeds, sizes, the ground's height) are then in those pixels. sloppy new my_game pico starts a game at PICO-8's 128 x 128.
Many things that move
The firefly's lights are positions, but a game with many things that each have several values (falling stars with their own speeds) keeps each in a struct, and the stars in an array:
struct Star:
pos: vec2
speed: f64
stars: Star[]
update = (dt: f64):
if every(1, 0.5): stars.push(Star(vec2(random(0.0, 1280.0), -10), random(100.0, 300.0)))
loop mut s in stars: s.pos.y += s.speed * dt # `mut`: change each one in the array
stars.retain((s): s.pos.y < 740) # keep the ones still on the screen
draw = ():
clear(rgb(0.05, 0.05, 0.12))
loop s in stars: circle(s.pos, 6, rgb(1, 0.9, 0.5))
loop mut s in stars: changes the stars themselves (without mut, s is a copy, and the compiler says so). retain keeps the elements the function says yes to, which is how things are taken out of an array as they go off the screen or get caught.
9. Sharing it
sloppy firefly.jo # run it
sloppy build firefly.jo # firefly: a program for this system (firefly.exe on Windows)
sloppy build firefly.jo --target windows # firefly.exe for Windows, from any system
sloppy build firefly.jo --target wasm # firefly.html: one file that runs in any browser
sloppy build firefly.jo --target wasm -o firefly.zip # the same, ready to upload to itch.io
Each is a single file with nothing to install: send it, or upload it. In the build: block, icon = "icon.png" gives the program an icon (the Windows program's, the window's, the web page's). What save_data keeps is in your user folder (on Linux ~/.local/share/Firefly, on Windows %APPDATA%\Firefly, on macOS ~/Library/Application Support/Firefly), and in the browser's storage for a web build. A Windows build also writes a .pdb beside the .exe: what debuggers read, not needed to play.
From here:
- Make an arcade game: the second tutorial, a small version of Rebound.
- The language: everything Sloppy has, with examples.
- The library: drawing, sound, input, 3D, GPU programs and the rest.
sloppy watch firefly.jokeeps the game running while you edit it: save, and the change appears without restarting.