Skip to content

inkasadev/inks2d

Repository files navigation

inks2d

inks2d

npm minzip npm-dt

stars code-quality license

inks2d is a free no-dependency Typescript game engine designed for developing 2D games. It provides you with a fast, friendly and clean framework to prototype and develop your games on. This means that most of the hard work is already done, letting you concentrate on the design and testing of your game.

Table of contents


Features

  • API inspired in part by Flash's display list, and should be easy to pick up for JS/TS developers.
  • All the most important sprites you need: rectangles, circles, triangles, lines, text and image sprites. You can make any of these sprites with only one line of code. You can also create your own custom sprite types.
  • Sound effect support with volume, panning, and fading, complete with one-line sound playback.
  • Quick and efficient particle effects and emitters for beautiful particle systems without slowing things down.
  • Simple keyboard, mouse and touch input state checking makes setting keys and events incredibly easy, yet powerful.
  • Universal asset loader to pre-load images, fonts, sounds and JSON data files. All popular file formats are supported. You can load new assets into the game at any time.
  • A lot of helper functions for animations, tilemaps, text, backdrops, and more.
  • Tree shaking support.

Packages

Package Version (click for changelogs)
inks2d vite version
create-inks2d create-inks2d version

Installation

With NPM:

$ npm create inks2d@latest

With Yarn:

$ yarn create inks2d

With PNPM:

$ pnpm create inks2d

Then follow the prompts!

You can also directly specify the project name and the platform you want to use via additional command line options. For example, to scaffold a inks2d + Web project, run:

# npm 6.x
npm create inks2d@latest my-inks2d-game --platform web

# npm 7+, extra double-dash is needed:
npm create inks2d@latest my-inks2d-game -- --platform web

# yarn
yarn create inks2d my-inks2d-game --platform web

# pnpm
pnpm create inks2d my-inks2d-game --platform web

See create-inks2d for more details on each supported platform


Basic Example

import { Engine, Scene } from "inks2d";
import { Rectangle } from "inks2d/geom";

const g = new Engine(640, 480);

class Main extends Scene {
  constructor() {
    super();
  }

  async start(e: Engine) {
    super.start(e);

    const rect = new Rectangle(50, 50, "blue");
    rect.position.x = g.stage.width / 2;
    rect.position.y = g.stage.height / 2;
    g.stage.addChild(rect);
  }
}

g.scene = new Main();
g.start();

Support and Resources

It was built by Phillipe Martins (aka "Inkasa Dev"), and is released for free under the MIT license, which means you can use it for almost any purpose (including commercial projects). We appreciate credit where possible, but it is not a requirement.


Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.


Showcase

Web

Pimi Jumpers Lolly Balls
Pimi Jumpers Lolly Balls

Android

Noah Crush Mania Shinobi Way Two Dots Get the Blacks
Noah Crush Mania Shinobi Way Two Dots Get the Blacks

Authors

Phillipe Martins
Phillipe Martins

See also the list of contributors who participated in this project.


License

This project is licensed under the MIT License - see the LICENSE.md file for details