Instance Variables

When you create a new object, it will come with certain variables already initialised with default values. These variables we call instance variables, since they will be created for every instance you place of the object in your game rooms, and once an instance is created the values of these variables are unique to that instance and only that instance. Some of these variables you will use a lot, like x and y, while others are required less depending on what you want to do, but in general they are very useful and where possible you should be looking to use them rather than creating your own custom variables.

Most instance variables can be set as well as read, permitting you to change the properties and behaviour of an instance simply by tweaking the value of a certain variable - you can prevent an instance from drawing, for example, by simply setting the visible built-in variable to false. Below you can find the different variables that are initialised for all instances of all objects in your game.

IMPORTANT! If an instance is in a sequence then some of these variables - like image_xscale  / image_yscale / image_angle / x / y - will be overwritten when the sequence updates each step after starting to be played.


These variables deal with general instance properties:


These variables deal with the instance position and movement:


Object Properties

The following variable holds the unique index ID of the object that the instance was created from:


These variables are all related to the sprite assigned to the instance and can be used to change what is drawn and how:


These variables deal with the collision mask:


These variables are related to paths and how the instance interacts with one, if assigned:


These variables are for setting an instance to use a timeline:



The following variables store information regarding the Sequence that may be controlling the instance at any given time:


There are a great number of built in variables for use with the physics functions of GameMaker Studio 2, and so to keep things clearer, they can be found in the section of the manual that covers everything related to the physics simulation: