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.
Example of Use
Assuming there is an object named objShip, an instance of it can be created like this:
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.