game-control is a simple&fast game controller with pixi.js.
npm install game-controlgame-control is a simple&fast game controller with pixi.js.
``bash`
npm i game-control
`typescript
import { GameControl } from "game-control"
const preloadImages = ["/static/img1", "/static/img2"]
const gameControl = new GameControl(htmlElement, preloadImages, gameInit, gameLoop)
function gameInit(){}
function gameLoop(){}
`
`typescript
import { GameObject } from "game-control"
export default class Aircraft extends GameObject
public onUpdate() {
// game loop, you can move or do something..
}
}
`
`typescript`
// add a new scene
gameControl.newScene("newScene")
// go to new scene
gameControl.goToScene("newScene")
`typescript``
gameControl.addGameObjectToScene(gameObject, "newScene")
// or default to current scene
gameControl.addGameObjectToScene(gameObject)