Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Instance Class Reference

General Entity related functions. More...

Public Member Functions

Entity Create (string className, number x, number y, value flag=0)
 Creates a new instance of an object class, and calls its Create event with the flag.
Entity GetNth (string className, integer n)
 Gets the n'th instance of an object class.
boolean IsClass (Entity entity, string className)
 Determines whether the instance is of a specified object class.
string GetClass (Entity entity)
 Gets the object class of a instance.
integer GetCount (string className)
 Gets amount of currently active instances in an object class.
Entity GetNextInstance (Entity entity, integer n)
 Gets the instance created after or before the specified instance. 0 is the next instance, -1 is the previous instance.
Entity GetBySlotID (integer slotID)
 Gets an instance by its slot ID.
void DisableAutoAnimate (boolean disableAutoAnimate)
 Disables the AutoAnimate function of entities.
void SetUseRenderRegions (boolean useRenderRegions)
 Sets whether entities will use Render Regions when rendering. If false, entities will use their Update Regions instead.
void Copy (Entity destInstance, Entity srcInstance, boolean copyClass=true)
 Copies an instance into another.
boolean ChangeClass (Entity entity, string className)
 Changes an instance's class.

Detailed Description

General Entity related functions.

Member Function Documentation

◆ ChangeClass()

boolean Instance.ChangeClass ( Entity entity,
string className )

Changes an instance's class.

Parameters
entityThe instance to swap.
classNameName of the object class.
Returns
Returns whether the instance was swapped.

◆ Copy()

void Instance.Copy ( Entity destInstance,
Entity srcInstance,
boolean copyClass = true )

Copies an instance into another.

Parameters
destInstanceThe destination instance.
srcInstanceThe source instance.
copyClassWhether to copy the class of the source entity.

◆ Create()

Entity Instance.Create ( string className,
number x,
number y,
value flag = 0 )

Creates a new instance of an object class, and calls its Create event with the flag.

Parameters
classNameName of the object class.
xX position of where to place the new instance.
yY position of where to place the new instance.
flagValue to pass to the Create event.
Returns
Returns the new instance.

◆ DisableAutoAnimate()

void Instance.DisableAutoAnimate ( boolean disableAutoAnimate)

Disables the AutoAnimate function of entities.

Parameters
disableAutoAnimateWhether to turn off the engine automatically applying AutoAnimate when entities are initialized.

◆ GetBySlotID()

Entity Instance.GetBySlotID ( integer slotID)

Gets an instance by its slot ID.

Parameters
slotIDThe slot ID to search a corresponding instance for.
Returns
Returns the instance corresponding to the specified slot ID, or null if no instance was found.

◆ GetClass()

string Instance.GetClass ( Entity entity)

Gets the object class of a instance.

Parameters
entityThe instance to check.
Returns
Returns a string value.

◆ GetCount()

integer Instance.GetCount ( string className)

Gets amount of currently active instances in an object class.

Parameters
classNameName of the object class.
Returns
Returns count of currently active instances in an object class.

◆ GetNextInstance()

Entity Instance.GetNextInstance ( Entity entity,
integer n )

Gets the instance created after or before the specified instance. 0 is the next instance, -1 is the previous instance.

Parameters
entityThe instance to check.
nHow many instances after or before the desired instance is to the checking instance.
Returns
Returns the desired instance.

◆ GetNth()

Entity Instance.GetNth ( string className,
integer n )

Gets the n'th instance of an object class.

Parameters
classNameName of the object class.
nn'th of object class' instances to get. 0 is first.
Returns
Returns n'th of object class' instances, null if instance cannot be found or class does not exist.

◆ IsClass()

boolean Instance.IsClass ( Entity entity,
string className )

Determines whether the instance is of a specified object class.

Parameters
entityThe instance to check. If there is no instance, this automatically returns false.
classNameName of the object class.
Returns
Returns whether the instance is of a specified object class.

◆ SetUseRenderRegions()

void Instance.SetUseRenderRegions ( boolean useRenderRegions)

Sets whether entities will use Render Regions when rendering. If false, entities will use their Update Regions instead.

Parameters
useRenderRegionsWhether render regions will be used.