instance_create() (Game Maker)
instance_create()
(Game Maker 6.1, 7)
instance_create - create an instance of an object
Description
id = instance_create( x, y, obj );
- id = returned instance id
- x = x location to create object
- y = y location to create object
- obj = name of object to create an instance of
instance_create() creates an instance of an object at the specified x/y coordinates. It also returns the instance id of the instance created, which can be put into a variable and used to manipulate the instance.
Examples
Example of Use
Assuming there is an object named objShip, an instance of it can be created like this:
instance_create(10,10,objShip);
Using the Instance Id
instance_create() returns the instance id of the instance created. If you assign it to a variable, you can then use the variable to manipulate the created instance.
new_ship = instance_create(10,10,objShip);
new_ship.hspeed = 2;
This method is useful for creating bullets.
Related Pages
Actions
Functions
page revision: 13, last edited: 05 Jul 2012 18:30