0.1.1 • Published 7 years ago

game-control v0.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

game-control

game-control is a simple&fast game controller with pixi.js.

How to use

npm i game-control

Create root controller

import { GameControl } from "game-control"

const preloadImages = ["/static/img1", "/static/img2"]
const gameControl = new GameControl(htmlElement, preloadImages, gameInit, gameLoop)

function gameInit(){}
function gameLoop(){}

Create game object

import { GameObject } from "game-control"

export default class Aircraft extends GameObject<PIXI.Sprite> {
    public onUpdate() {
        // game loop, you can move or do something..
    }
}

Add and switch scene

// add a new scene
gameControl.newScene("newScene")
// go to new scene
gameControl.goToScene("newScene")

Add game object to scene

gameControl.addGameObjectToScene(gameObject, "newScene")
// or default to current scene
gameControl.addGameObjectToScene(gameObject)
0.1.1

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago