

GitHub - replit/kaboom: ? JavaScript game library
source link: https://github.com/replit/kaboom
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Kaboom.js is a JavaScript library that helps you make games fast and fun!
Check out our official website!
Example
<script src="https://kaboomjs.com/lib/0.5.1/kaboom.js"></script> <script type="module"> // initialize kaboom context const k = kaboom(); // define a scene k.scene("main", () => { // add a text at position (100, 100) k.add([ k.text("ohhimark", 32), k.pos(100, 100), ]); }); // start the game k.start("main"); </script>
You can paste this directly into an html
file and start playing around!
Usage
- self hosted
<script src="https://kaboomjs.com/lib/0.5.1/kaboom.js"></script>
All available version tags can be found in CHANGELOG.md, or Github releases.
Special Version Tags:
dev
: current master with the newest unreleased features / fixes, but not guaranteed to be stablelatest
: latest release
- third party
kaboom is on npm thus supported by most js lib CDN providers
<script src="https://unpkg.com/[email protected]/dist/kaboom.js"></script> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/kaboom.js"></script>
When imported in the browser, the script will expose a global kaboom
function to initialize a kaboom context, returning an object containing all the functions
const k = kaboom(); k.init(); k.scene(...); k.start(...);
You can also import all functions to the global namespace by giving a global
flag
kaboom({ global: true, }); init(); scene(...); start(...);
Kaboom also provide ES module and commonJS module exports with .mjs
and .cjs
, e.g,
import kaboom from "https://kaboomjs.com/lib/0.5.1/kaboom.mjs";
npm package
$ npm install kaboom
// main.ts import kaboom, { Vec2, GameObj, } from "kaboom"; import asepritePlugin from "kaboom/plugins/aseprite"; const k = kaboom({ plugins: [ asepritePlugin, ], }); function spawnBullet(p: Vec2): GameObj { return k.add([ k.pos(p), k.sprite("bullet"), ]); }
also works with cjs
const kaboom = require("kaboom");
npm run dev
to watch & build lib- go to http://localhost:8000/examples
- edit examples in
examples/
to test - make sure not to break any existing examples
- Featured on Console 50
- Shoutout to Umayr for kindly offering the "kaboom" npm package name
Recommend
-
68
今天,我们给大家介绍的是一款名叫Kaboom的自动化渗透测试工具,广大研究人员可以使用这款功能强大的工具来完成日常的渗透测试任务。
-
45
2019-11-21 This is a post about development ofKaboom, a Minesweeper clone with a twist. Apparently
-
4
How Replit used legal threats to kill my open-source project I think you should take it down and stop working on it. I'll be engaging our lawyers on Monday if it's still up by then. [...] We were a tiny company when you...
-
25
mario A game of Mario using JavaScript and Kaboom.js View the tutorial here In this video I show you how to build a Mario in JavaScript using the Kaboom.js library in my code e...
-
11
Builds Controlling a Battlesnake with a Webcam, Replit, and Your Face
-
14
Code Zelda in JavaScript and Kaboom.js Jul 23 ・2 min read
-
9
-
20
Careers at ReplitWe’re on a mission to make programming collaborative, accessible, and fun for everyone. Creating the future of computing is a team effort, though.~/applyToReplit$scri...
-
44
Building with Nix on Replit As of May 2021, Replit supports all programming languages through the power of Nix. But Nix can do a whole lot more than just enable us to use new languages. In th...
-
6
Basic Express Server Using Replit.com In this post, I will introduce how to set up the most basic Express server in Node.JS, and how...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK