Instance create

Explanation
This function will create an instance of object obj at position (x,y). x and y are room position in pixels and can be anywhere, outside the current view, even outside the physical room size, these are especially good for creating objects that start outside the room area and then come into view.

The function returns the id of the instance. You can store this id in a global variable such that later you can e.g. destroy that instance or change certain properties of it.

Examples
For example instance_create(0,0,obj_enemy) will create obj_player at the top-left hand corner of the screen, while instance_create(-100,0,obj_enemy) will create the object 100 pixels to the left outside of the current screen, this is handy if you want your enemy to 'fly in'.

You're not just limited to absolute co-ordinates (numbers), you can create an object relative to another object, e.g. say for example you wanted something to appear next to your player, no matter where on the screen he is, you could have something like:

instance_create(obj_player.x}+10,obj_player.y+10,obj_fairy);

This will create the object 'obj_fairy' 10 pixels to the right and 10 pixels down from the sprites origin (default is the top-left of the sprite). You can even create objects appear at a random position on the screen:

instance_create(random(room_width), random(room_height),obj_bullethole);

The function returns the id of the instance. You can use this to set further properties.

globalvar iii; iii = instance_create(200,200,obj_fairy); iii.speed = 8; iii.direction = 270;

This will create the fairy at position (200,200) and give it a downward motion.