instance_create(x, y, obj);
Argument | Description |
---|---|
x | The x position the object will be created at. |
y | The y position the object will be created at. |
obj | The object to create an instance of. |
Returns: Real
With this function you can create a new instance of the
specified object at any given point within the room. This function
returns the id of
the new instance which can then be stored in a variable or used to
access that instance. Note that this function will also call the
create event of the instance being created before continuing
with the code or actions for the event that used the function.
Example:
var inst;
inst = instance_create(x, y, obj_Bullet);
with (inst)
{
speed = other.shoot_speed;
direction = other.image_angle;
}
The above code creates anew instance of the object "obj_Bullet" and stores the instance id in a variable. This variable is then used to assign speed and direction to the new instance.