new GameObject(pZIndex)
Object representing a game object.
Parameters:
Name | Type | Description |
---|---|---|
pZIndex |
int | Specifies the z position (the depth) of the game object. |
- Source:
Members
-
components :Array
-
List of the components owned by the game object.
Type:
- Array
- Source:
-
scrollFactor :FM.Vector
-
Allows to specify different degrees of scrolling (useful for parallax).
Type:
- Source:
-
zIndex :int
-
Specify the depth at which the game object is.
Type:
- int
- Source:
Methods
-
addComponent(pComponent) → {FM.Component}
-
Add a component to the game object.
Parameters:
Name Type Description pComponent
FM.Component The component to be added. - Source:
Returns:
The component just added.- Type
- FM.Component
-
addType(pType)
-
Specify a type associated to this game object.
Parameters:
Name Type Description pType
FM.ObjectType The type to add. - Source:
-
destroy()
-
Destroy the game object. Don't forget to remove it from the state too. Better use the remove method from state.
- Source:
-
getComponent(pType) → {FM.Component}
-
Retrive a particular component.
Parameters:
Name Type Description pType
FM.ComponentTypes The component's type to be retrieved. - Source:
Returns:
The component retrieved.- Type
- FM.Component
-
getId() → {int}
-
Retrieve the id of the game object.
- Source:
Returns:
ID of the game object.- Type
- int
-
getTypes() → {Array}
-
Retrieve the types of the game object.
- Source:
Returns:
Types of the game object.- Type
- Array
-
hasType(pType) → {boolean}
-
Check if this game object is associated to a given type.
Parameters:
Name Type Description pType
FM.ObjectType The type to look for. - Source:
Returns:
Whether the type specified is associated to this game object or not.- Type
- boolean
-
hide()
-
Hide the game object.
- Source:
-
isAlive() → {boolean}
-
Check if the game object is alive.
- Source:
Returns:
True if the game object is alive, false otherwise.- Type
- boolean
-
isVisible() → {boolean}
-
Check if the game object is visible.
- Source:
Returns:
True if the game object is visible, false otherwise.- Type
- boolean
-
kill()
-
Kill the game object.
- Source:
-
removeType(pType)
-
Remove a type associated to this game object.
Parameters:
Name Type Description pType
FM.ObjectType The type to remove. - Source:
-
revive()
-
Revive the game object.
- Source:
-
setId(pId)
-
Set the id of the game object.
Parameters:
Name Type Description pId
int ID to give to the game object. - Source:
-
show()
-
Show the game object.
- Source: