An interactive demo of the blocks API. Play the little game, then read the code that makes it tick — every mechanic is one block.
Space / tap to jump · collect stars · avoid spikes
boomkit({ background: "#242933", debug: true });
const bomb = add([
sprite("bomb"),
pos(70, 330),
body(),
area(),
]);
setGravity(1000);
bomb.onKeyPress("space", () => bomb.jump());
bomb.onClick(() => bomb.jump());
bomb.onCollide("spikes", () => {
bomb.hurt(5);
bomb.destroy();
shake(8);
flash("#cc425e", 0.2);
});
bomb.onCollide("star", (star) => {
star.destroy();
score++;
play("ding");
});
Friendly API. Easy to learn, easy to teach. No build step needed to try it — copy this into your index.html and you're playing.