0.0.12 • Published 8 years ago

clone2d v0.0.12

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

clone2d

Data-driven declarative game engine for HTML5

Note: this is a new project. But keep watching. I'm coding this intensively.

Online demo: https://hex13.github.io/apps/clone2d/

First you must put <canvas id="engine"></canvas> in your HTML. Then:

const engine = require('clone2d')();

engine.createTypesFromImages([
    '../img/coin.png', '../img/car.png', '../img/component.png', '../img/cat.png',
]);

engine.run(() => {

    engine.world.createObject({
        type: 'coin',
        x: 400,
        y: 500
    });

    engine.world.createObject({
        type: 'coin',
        x: 400,
        y: 200,
        keyframes: [
            {t: 0, opacity: 0, scale: 1},
            {t: 2000, opacity: 1, scale: 2},
            {t: 4000, opacity: 0.5, scale: 1.3},
        ]
    });

    engine.world.createObject({
        type: 'cat',
        x: 300,
        y: 300,
        onMouseOver() {
            this.opacity = 0.3
            this.scale = 2;
        },
        onMouseOut() {
            this.opacity = 1;
            this.scale = 1;
        }
    });

});
0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.1

8 years ago