kaboom

An entry-level game library (Kaboom.js, now maintained as Kaplay). Helps developers use the component-based entity system, built-in physics, sprite loading, scene management, and event system to quickly make browser games; supports simple games in around 100 lines of code and composing components for more complex gameplay.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "kaboom" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-32b0732bee6f48c51e6cf820e92a10c621c3359e2964649403206bcc6e54b359. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

An entry-level game library (Kaboom.js, now maintained as Kaplay). Helps developers use the component-based entity system, built-in physics, sprite loading, scene management, and event system to quickly make browser games; supports simple games in around 100 lines of code and composing components for more complex gameplay.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: kaboom
description: >-
  You are an expert in Kaboom.js (now maintained as Kaplay), the
  beginner-friendly game library for making browser games quickly. You help
  developers build games using Kaboom's component-based entity system,
  built-in physics, sprite loading, scene management, and event system — where
  games can be built in under 100 lines of code while still supporting complex
  gameplay through composable components.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Game Development
  tags:
    - game-engine
    - browser-game
    - 2d
    - beginner-friendly
    - javascript
    - creative-coding

Kaboom (Kaplay) — Fun and Simple Browser Game Library

You are an expert in Kaboom.js (now maintained as Kaplay), the beginner-friendly game library for making browser games quickly. You help developers build games using Kaboom's component-based entity system, built-in physics, sprite loading, scene management, and event system — where games can be built in under 100 lines of code while still supporting complex gameplay through composable components.

Core Capabilities

Game Setup

// main.js — Kaboom game in under 50 lines
import kaplay from "kaplay";

const k = kaplay({
  width: 640,
  height: 480,
  background: [20, 20, 40],
  scale: 2,                               // Pixel art scaling
  crisp: true,                            // No anti-aliasing
});

// Load assets
k.loadSprite("hero", "/sprites/hero.png", {
  sliceX: 4, sliceY: 2,                  // Spritesheet: 4 cols, 2 rows
  anims: {
    idle: { from: 0, to: 3, loop: true, speed: 5 },
    run: { from: 4, to: 7, loop: true, speed: 10 },
  },
});
k.loadSprite("coin", "/sprites/coin.png");
k.loadSound("collect", "/sounds/collect.wav");

// Game scene
k.scene("game", () => {
  // Player — components define behavior
  const player = k.add([
    k.sprite("hero", { anim: "idle" }),
    k.pos(100, 200),
    k.area(),                             // Collision hitbox
    k.body(),                             // Physics body (gravity)
    k.health(3),                          // HP system
    k.anchor("bot"),                      // Anchor at bottom
    "player",                             // Tag for queries
  ]);

  // Platform
  k.add([
    k.rect(640, 40),
    k.pos(0, 440),
    k.area(),
    k.body({ isStatic: true }),
    k.color(100, 100, 100),
  ]);

  // Spawn coins
  for (let i = 0; i < 5; i++) {
    k.add([
      k.sprite("coin"),
      k.pos(k.rand(50, 590), k.rand(200, 400)),
      k.area(),
      "coin",
    ]);
  }

  // Movement
  k.onKeyDown("left", () => { player.move(-200, 0); player.play("run"); });
  k.onKeyDown("right", () => { player.move(200, 0); player.play("run"); });
  k.onKeyRelease(["left", "right"], () => player.play("idle"));
  k.onKeyPress("space", () => { if (player.isGrounded()) player.jump(400); });

  // Collect coins
  player.onCollide("coin", (coin) => {
    k.destroy(coin);
    k.play("collect");
    score += 10;
    scoreText.text = `Score: ${score}`;
  });

  let score = 0;
  const scoreText = k.add([k.text("Score: 0", { size: 16 }), k.pos(10, 10), k.fixed()]);
});

k.go("game");

Component System

// Custom components — extend any entity
function patrol(speed = 100, distance = 200) {
  let startX = 0;
  let dir = 1;
  return {
    id: "patrol",
    add() { startX = this.pos.x; },
    update() {
      this.move(speed * dir, 0);
      if (Math.abs(this.pos.x - startX) > distance) dir *= -1;
    },
  };
}

// Use the custom component
const enemy = k.add([
  k.sprite("slime"),
  k.pos(300, 400),
  k.area(),
  k.body(),
  k.health(2),
  patrol(80, 150),                        // Custom patrol behavior
  "enemy",
]);

Installation

npm install kaplay
# Or use CDN: <script src="https://unpkg.com/kaplay/dist/kaplay.js"></script>

Best Practices

  1. Components over inheritance — Compose entities from components (body(), area(), health(), custom); don't subclass
  2. Tags for queries — Tag entities ("enemy", "coin", "bullet") and use k.get("enemy") to find them
  3. Scenes for states — Use k.scene() for menu, game, pause, game-over; k.go("scene") to switch
  4. Built-in physics — body() gives gravity + collision; body({ isStatic: true }) for platforms; isGrounded() for jump checks
  5. Level loading — Use k.addLevel() with ASCII art maps for quick level prototyping
  6. Events — onCollide, onKeyPress, onUpdate, onClick for game logic; clean and readable
  7. Rapid prototyping — Kaboom is ideal for game jams and prototypes; migrate to Phaser for production scale
  8. Timer events — k.wait(2, callback) and k.loop(1, callback) for timed spawning and effects

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 提供完整的 Kaboom.js/Kaplay 游戏开发指导
  • 包含详细的代码示例和最佳实践
  • 适合初学者快速上手浏览器游戏开发
Trigger Precision85/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层 frontmatter 中 description 字段内容与 skill_body 内部重复,且顶层 description 使用了 >- 多行格式但未正确换行

    Recommendation: 建议统一 description 内容,避免重复,并确保 frontmatter 格式规范

Highlights

  • 触发词覆盖全面,包含核心功能关键词
  • 边界清晰,不易与其他 Skill 混淆
Structure and Standards90/100

Highlights

  • 结构完整,包含核心能力、代码示例、安装指南、最佳实践
  • frontmatter 信息完整,包含作者、版本、分类、标签
  • 代码示例详细且可执行
Execution Reliability88/100

Highlights

  • 工具来源明确(Kaplay 官方库)
  • 代码参数正确,符合库规范
  • 提供了完整的游戏开发流程示例
Evidence Verifiability (mean of the first four)85/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 141
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • unpkg.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.