Game FrameWork for JavaScript 2D WebGL Games. Unity-inspired architecture: GameObject, Physics, Body, Container, Sprite, Animator, StateMachine, TextureAtlas, Resources loading.
After making countless indie games, dozens made in html5 webgl, I like to have in such:
destroy$ event subject.
import { Scene, GameObject } from 'make2d'
// create a scene
const scene = new Scene({
visible: true,
autoSort: true
})
// enable physics for scene
scene.update$.pipe(takeUntil(scene.destroy$)).subscribe(() => {
scene.physics.separate()
})
// create entity
const gameObject = new GameObject('Entity Name')
// add entity to scene
scene.addChild(gameObject)
// rxjs - subscribe to update function until entity is destroyed
gameObject.update$
.pipe(takeUntil(gameObject.destroy$))
.subscribe((deltaTime) => {
gameObject.update(gameObject, deltaTime)
})
[pixi WebGL Canvas]
└──[Scene]
└──[Collision Detection]
└──[GameObject x 50]
├──[Body]
└──[Animator]
└──[StateMachine]
Check out the demo sandbox to see below code in action.
PIXI.Sprite and
Lifecycle
PIXI.Container and
Lifecycle,
PIXI.AnimatedSprite
Unity, has components
node.js environment
main class
state management component
yarn add -D make2d
Here is the in-depth api documentation easy to browse.