Version: stable
FUNCTION | |
---|---|
factory.get_status() | Get factory status |
factory.unload() | Unload resources previously loaded using factory.load |
factory.load() | Load resources of a factory prototype. |
factory.create() | make a factory create a new game object |
CONSTANT | |
---|---|
factory.STATUS_UNLOADED | unloaded |
factory.STATUS_LOADING | loading |
factory.STATUS_LOADED | loaded |
factory.get_status([url])
PARAMETERS
[url] |
the factory component to get status from |
RETURNS
status |
status of the factory component
|
factory.unload([url])
PARAMETERS
[url] |
the factory component to unload |
EXAMPLES
How to unload resources of a factory prototype loaded with factory.loadfactory.unload("#factory")
factory.load([url],[complete_function])
PARAMETERS
[url] |
the factory component to load |
[complete_function] |
function to call when resources are loaded.
|
EXAMPLES
How to load resources of a factory prototype.factory.load("#factory", function(self, url, result) end)
factory.create(url,[position],[rotation],[properties],[scale])
PARAMETERS
url |
the factory that should create a game object. |
[position] |
the position of the new game object, the position of the game object calling factory.create() is used by default, or if the value is nil . |
[rotation] |
the rotation of the new game object, the rotation of the game object calling factory.create() is used by default, or if the value is nil . |
[properties] |
the properties defined in a script attached to the new game object. |
[scale] |
the scale of the new game object (must be greater than 0), the scale of the game object containing the factory is used by default, or if the value is nil |
RETURNS
id |
the global id of the spawned game object |
EXAMPLES
How to create a new game object:function init(self) -- create a new game object and provide property values self.my_created_object = factory.create("#factory", nil, nil, {my_value = 1}) -- communicate with the object msg.post(self.my_created_object, "hello") end
go.property("my_value", 0) function init(self) -- do something with self.my_value which is now one end
unloaded
unloaded
loading
loading
loaded
loaded