Difference between revisions of "GameObj"
(→Game Object Properties) |
(→Game Object Properties) |
||
Line 3: | Line 3: | ||
A potion, a monster, a door, and a sword are all examples of GameObjs. | A potion, a monster, a door, and a sword are all examples of GameObjs. | ||
== Game Object Properties == | == Game Object Properties == | ||
− | * <code>Id</code>:The unique Id of a GameObject, Ids are unique on a per cluster basis. | + | * '''<code>Id</code>''':The unique Id of a GameObject, Ids are unique on a per cluster basis. |
**Getting the Id of a gameObject: <code>mId = mObj.Id</code> | **Getting the Id of a gameObject: <code>mId = mObj.Id</code> | ||
+ | ** Setter: Gameobject Ids cannot be set. They are created and assigned by the engine on object creation. | ||
**Referencing a gameObj from a known Id: <code>mGameObj = GameObj(mId)</code | **Referencing a gameObj from a known Id: <code>mGameObj = GameObj(mId)</code | ||
− | * <code>Name</code>: The name of a gameobject, visible in game. | + | * '''<code>Name</code>''': The name of a gameobject, visible in game. |
**Getter: <code>mName = mObj:GetName()</code> | **Getter: <code>mName = mObj:GetName()</code> | ||
**Setter: <code>mObj:SetName("Samogh the Blacksmith")</code> | **Setter: <code>mObj:SetName("Samogh the Blacksmith")</code> |
Revision as of 12:37, 1 November 2016
Game Object (GameObj) is a Dynamic object within the game that can occupy a position of the world, including a Container. Game Objects are the most common of all Objects and can have Variables and/or Modules attached to them.
A potion, a monster, a door, and a sword are all examples of GameObjs.
Game Object Properties
Id
:The unique Id of a GameObject, Ids are unique on a per cluster basis.- Getting the Id of a gameObject:
mId = mObj.Id
- Setter: Gameobject Ids cannot be set. They are created and assigned by the engine on object creation.
- Referencing a gameObj from a known Id:
mGameObj = GameObj(mId)</code
- Getting the Id of a gameObject:
Name
: The name of a gameobject, visible in game.- Getter:
mName = mObj:GetName()
- Setter:
mObj:SetName("Samogh the Blacksmith")
- Getter:
Hue
Tips
- Obj variables should only contain data you are intending to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value.
- GameObj can communicate between each other using SendMessage just like Modules.