Jump to: navigation, search

In ENIGMA, an instance refers to an actual instance, or representation, or copy, if you will, of an object. An instance is to an object as you are to the human species. An object can have any number of instances, each functioning independently of one another with their own set of local variables. There is also a page on Instance and Motion Functions.


When an object is created and its behavior programmed (e.g. a bullet), then when it is created in the game that is an instance of that object. So when a player shoots, then every bullet is its own instance.

Built-in variables

Every instance have built in variables that are local to the instance itself. They are updated automatically or can be set.

Variable Description
x x position of the instance
y y position of the instance
xprevious x position the instance was in the previous step
yprevious y position the instance was in the previous step
direction This is the direction of the instance. Its position is updated every step according to the speed and direction
speed The amount of pixels the instance will move every step in the set direction
hspeed Horizontal speed component (changes automatically according to speed and direction)
vspeed Vertical speed component (changes according to the speed and direction)
friction Amount of speed the instance will lose every step
gravity Amount of gravity (acceleration) in pixels per second
gravity_direction The direction gravity will pull
solid Whether the instance is solid or not
persistent Whether the instance is persistent
object_index* Index of the object this is an instance of
id* The unique identifier for the instance (value will be >= 100000).

*These variables are constant and cannot be changed.

Personal tools