Impact is made up of several core classes that revolve around the
game framework and all the necessary systems such as rendering, maps,
sounds, and more. All the classes are in the
ig namespace, which is set up by the core class.
Here is a list of the main classes used in Impact along with a short
description of what they do:
ig object provides the
module definition and loading capabilities as well as some utility
takes care of animating an entity or BackgroundMap tiles. Frames
AnimationSheet—an image with all
animation frames—are drawn as specified by the animation’s
frameTime and sequence.
ig.AnimationSheet is a thin
wrapper around an
object. It specifies the
height properties for each
animation frame in the sheet. It is used by the
tiles from a Tileset, as indicated by its 2D data array.
ig.Collision takes a 2D
TileMap and allows tracing against it for collisions.
Interactive objects in the game world are typically subclassed
from this base entity class. It provides animation, drawing, and
basic physics. Subclassing your entities from
ig.Entity ensures that it can be added to
the game world, react to the CollisionMap along with other entities,
and be added to a level within Weltmeister.
ig.Font object loads a
specially formatted font image and allows you to draw text with
ig.Game is the main hub for
your game. It hosts all currently active entities, BackgroundMaps,
and a CollisionMap. You can subclass your own game class from
ig.Image is a wrapper
around image resources (.png, .gif, .jpeg). It takes care of loading
and scaling the source image. You can draw the whole image by
.draw() or just one tile
of it by calling
ig.Input handles all
keyboard and mouse input.
ig.Loader is the default
pre-loader for all images and sounds that the game needs. By
default, it displays a white progress bar on a black
ig.Map is the base class
ig.CollisionMap. It only provides basic
access to the tiles in the map data.
ig.Music offers the ability
to play a list of background music in order or randomly.
An instance of
represents a sound file to be used as background music or game
The SoundManager takes care of loading sounds and providing
ig.Sound instances. An instance of the
SoundManager is automatically created at
ig.soundManager by the
ig.System takes care of
starting and stopping the run loop and calls the
.run() method on the current game object.
It also does the housekeeping for
ig.Input and provides some utility
ig.Timer has two
distinct modes of operation. You can either get the difference by
.delta() between the
current time and the timer’s target time (as set by the constructor
.set()) or just get the
current tick—the time since the last call to
You can learn more about each of these classes and their methods on Impact’s website under the documentation section at http://impactjs.com/documentation.