gnysek
Member
Since GM:S 1.x and in GMS2 too, we can set name for instances placed in room editor. As they were numbered from 1000000 up in pre-GMS, they now are usually named "inst_XXXXX" where XXXX is a hex number.
Later on, you can use this variable inside code, since in fact inst_XXXX constant is just an instance id.
But since you can rename them, instead of "inst_A02FBDA6" you can have "teleporter_north_in_room_city".
Would be great, if we can access information about room data for all instances placed in room editor.
From what I remember, instance id is unique for whole game (every instance id is +1 to the last one, even if some were destroyed) and there's no duplicates.
My proposal is:
That would be useful for games in which you teleport between rooms forth and backward, so you can start in different places, but currently you cannot access x/y position of instance in another room (as long as it wasn't persistent), so you need to hardcode positions.
For now constants instead of id's are useful only in same room.
Later on, you can use this variable inside code, since in fact inst_XXXX constant is just an instance id.
But since you can rename them, instead of "inst_A02FBDA6" you can have "teleporter_north_in_room_city".
Would be great, if we can access information about room data for all instances placed in room editor.
From what I remember, instance id is unique for whole game (every instance id is +1 to the last one, even if some were destroyed) and there's no duplicates.
My proposal is:
Code:
room_get_instance_x(instanceId); // returns initial x-coordinate of instance with this ID
room_get_instance_y(instanceId);
room_get_instance_room(instanceId); // returns in which room this instance is placed
For now constants instead of id's are useful only in same room.