The fun and open source game library for HTML5 Games
KAPLAY (/ˈkæpleɪ/) is a JavaScript and TypeScript game library that makes it easy to create games for the web. It's free, open-source and fun.
An enjoyable API based on blocks
KAPLAY is enjoyable and fun to use and easy to learn. That's why we've designed it to be based on blocks and functions. Here are some of the most common blocks you'll use.
Start game
kaplay();
Play a sound
play("sound");
Destroy an object
destroy(obj)
Get objs with tag
get("dino")
Jump
obj.jump() // body() needed
Add a comp dynamically
obj.use(rotate(90))
Log on the screen
debug.log("hi")
Add obj with tag
add([ sprite("rex"), pos(20, 40), "dino", ]);
Add transform components
add([ sprite("bean") pos(10, 10), rotate(90), anchor("center"), ]);
Create scenes
scene("win", (score) => { debug.log(score) }); // go and send params go("win", 1);
Presses / Releases a key
onKeyPress("f", () => { // code }); onKeyRelease(...); onKeyDown(...);
With physics
add([ sprite("bean"), area(), body(), ]);
Run logic on objs with tag
onUpdate("dino", (obj) => { // needs rotate() obj.angle += 15 });
Hoverable & Clickable
add([ sprite("bean"), area() ]);
Add a sprite
add([ sprite("bean"), pos(20, 40) ]);
Add a text
add([ text("ohhi"), pos(20, 40) ]);
Load assets
loadSprite("sprite", "/bean.png"); loadFont("font", "/font.ttf"); loadSound("sound", "/sound.mp3");
Run on update
onUpdate(() => { // code });
Run on draw
onDraw(() => { // code });
Run on loop
loop(1, () => { // every 1s });
Wait for run
wait(1, () => { // after 1s });
No more long nested methods likeobj.position.transform.translate(10, 20)
Just simple and fun to use methods and functions.
Voices of KAPLAYERS
What our users say about KAPLAY. We are proud to have such a great community.
Endel@endel
Colyseus.io, Brawlball.io and Mazmorra.io creator
KAPLAY API is incredibly intuitive and easy to read. I love how it combines simplicity with power, it’s a truly innovative library that brings HTML5 games to life!
JSLegend@jslegendev
JavaScript content creator
KAPLAY has a very intuitive and easy to use API that makes gamedev a breeze compared to other alternatives.
Isaac Pante@ipante
Game Designer & College Teacher
KAPLAY is the best framework to teach programming and create fast and furious video games. We already won three awards with it, and counting!
niceEli@niceEli
Developer
KAPLAY is one of the best libraries for TypeScript I’ve tried. It’s a very simple API yet very powerful.
Amy@amyspark-ng
Clickery Hexagon's developer
The development of KAPLAY has allowed me to make Clickery an awesome game.