Once you have integrated the source code into your project, you can access several utilities, object constructors, and the main project runtime through it. Here are the exposed exports:
The default ascii.js export is the Runtime class.
import Runtime from "https://cdn.jsdelivr.net/gh/nottimtam/ascii.js/dist/bundle.esm.js";The other items exported from the ascii.js distribution are:
The core objects can be extended to create new object types, behaviors, and more.
- Core — The lowest level scene object.
- GameObject — A core object with extended features for displaying in a scene.
- Behavior — An object that extends the features of a
GameObject.
These objects extend the GameObject class for quicker Scene implementation.
- Box — An object that uses ASCII box-drawing characters to create a box on screen.
- Menu — A simple interface for a user to select from a list of options.
- Text — A quick way to display a string of text to the screen.
- TextInput — A simple text input box to take user input.
Behaviors extended the functionality of objects. You can create your own behaviors by extending the Behavior class.
- ScrollTo — Forces the camera to scroll to this behavior's parent object's position.
- TopDownMovement — A quick way to add top-down user controls to an
GameObject.
A subset of classes for animating an object over time.
- Animate — The main animation control object.
- Animation — A collection of frames and controls for how they are displayed.
- AnimationFrame — A single frame of a
GameObjects animation.
These classes are used for managing game scenes and displaying them on screen.
- Scene — A scene can be seen as an individual "level" or "window" in the game. It has its own renderer, input manager, and
GameObjects. - Layer — A layer of objects in a scene. Layers are rendered one on top of the other.
- Frame — Frames are generated by the renderer, they contain text and style data for rendering to the canvas.
- Pixel — A single character to be displayed on screen.
- PixelMesh — A grid of characters to display on screen.
These utility methods are used all over ascii.js to improve functionality beyond the methods included in JavaScript.
- AdvMath — Math utilities beyond what is provided in JavaScripts
Mathclass. - dataUtils — Data management/manipulation utilities.
Just like all variables, methods, and arguments that start with double-underscores, these exports are exposed publicly, but should generally be avoided by those unfamiliar with them.
- __Renderer — Manages rendering of frames.
- __LayerManager — Manages individual renderer layers.
- __InputManager — Handles user inputs.
- __AudioManager — Creates, manages, and plays
Sounds. - __Sound — A controller for playing an individual sound.
- __Camera — Camera for controlling what is displayed in a frame.