smallyjs
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

SmallyJS

smallyjs is a javascript library that creates a small HTML5 game easily.


Status

This project is under development. Don't use it on the production.


Installation

- CDN

<script src="https://cdn.jsdelivr.net/npm/smallyjs@0.1.5/dist/smallyjs.min.js"></script>

- npm

npm install smallyjs

Hello World

<script src="https://cdn.jsdelivr.net/npm/smallyjs@0.1.5/dist/smallyjs.min.js"></script>
<script>
    // Create new game
    const game = Smally.Game({
        title: "Hello World",
        bg: "#efefef",
    });

    // Create new scene
    const mainScene = Smally.Scene();

    // Title text
    const centerPos = {
        x: mainScene.getConf().width / 2,
        y: mainScene.getConf().height / 2,
    };
    const title = Smally.Text({
        content:"Hello World",
        posX: centerPos.x,
        posY: centerPos.y
    });
    // Add title to the main scene
    mainScene.addChild(title);

    // Add main scene to our game
    game.addMainScene(mainScene);

    // Start game
    game.start();
</script>

For more, please see the exemples/ directory.

Readme

Keywords

Package Sidebar

Install

npm i smallyjs

Weekly Downloads

2

Version

0.1.6

License

none

Unpacked Size

56.2 kB

Total Files

10

Last publish

Collaborators

  • smallygame