Skip to content

Latest commit

 

History

History
75 lines (48 loc) · 3.78 KB

File metadata and controls

75 lines (48 loc) · 3.78 KB

Module

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:

Runtime

The default ascii.js export is the Runtime class.

import Runtime from "https://cdn.jsdelivr.net/gh/nottimtam/ascii.js/dist/bundle.esm.js";

Other Exports

The other items exported from the ascii.js distribution are:

Core

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.

Objects

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

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.

Animate Behavior

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.

Rendering

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.

Utilities

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 Math class.
  • dataUtils — Data management/manipulation utilities.

Additional Exposed Exports

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.