Get Instance Variable


With this action you can get any one of the listed built in variables. All instances of all objects have a number of variables already created within them to hold essential information like the current x/y position, the speed, the direction, visibility and many other things. The instance variables that you can get the values of are:

Once you select the built in variable to get, you then set the target variable to hold the returned value. If you flag this variable as a temporary variable then it will be created for you in the action and will be available only until the end of the event or action script. You can also retrieve the values of additional variables in the same action by clicking the plus icon beside the action, and selecting another instance variable and giving an accompanying variable to store the returned value.

Action Syntax:

Get Instance Variable Syntax


Argument Description
Variable The built in variable to get
Target The target variable to use to hold the returned value


Set Instance Variable Example

The above action block code gets the values for the previous x/y position and then comapres them to the current x/y position. If they are not the same, then the sprite index for the instance is changed and it's image index is set to 0.