API Reference

Complete method reference for all core classes.

Entity

Method Description
addComponent(name, comp) Attach a component under a string key
getComponent(name) Retrieve attached component by key
removeComponent(name) Detach and destroy a component
hasComponent(name) Check if component exists
destroy() Remove entity from scene at end of frame

Scene

Method Description
addEntity(entity) Add entity to this scene
removeEntity(entity) Remove entity from scene
raycast(x, y, options) Cast a ray, returns hit info or null
findEntityByTag(tag) Find first entity matching tag
findEntitiesByTag(tag) Find all entities matching tag

SceneManager

Method Description
addScene(scene) Register a scene
startScene(name) Load and start a registered scene
switchScene(name) Transition to another scene

Links

GitHub → NPM → Live Demo → Examples →