Variables can be used for a lot of things. For example, stocks of items, lives, health, rpg stats, etc. They can be useful and easy to use. You may also used variables when the player touches an object or destroys an enemy.
Set Variable
There are many built-in variables in the game. With this action you can change these. Also you can create your own variables and assign values to them. You specify the name of the variable and the new value. When you check the Relative box, the value is added to the current value of the variable. Please note that this can only be done if the variable already has a value assigned to it! See below for more information about variables.
This d&d action is used to create your own variables and set values to them. To do this, you must first set the desired variable and the desired value to it in the create event of an object. After that, you then check the Relative box to add the value to the current value of the assigned variable.
Draw Variable
With this action you can draw the value of a variable at a particular position on the screen. Note that this can only be used in the draw event of an object.
This d&d action is used to draw the value of a variable at a certain position on the screen. This action is only effective in the draw event of an object. You must also set the specific object of a draw variable referring to the specific object.
To do this in coding, you must do the same thing for creating variables using this code of a specific object you're referring. For example, obj_player.insertvariablename=value;
For global variables you used this code instead:
global.insertvariablename=value;
draw_text(x,y,"x" + string(obj_insertvariable_name));
The x is there to indicate the stocks of items, score, and lives in platform game elements.
draw_sprite(spr_insertitemname,0,x,y);
This is for drawing the variable of a specific variable to show the current value on the screen.
Set Variable
There are many built-in variables in the game. With this action you can change these. Also you can create your own variables and assign values to them. You specify the name of the variable and the new value. When you check the Relative box, the value is added to the current value of the variable. Please note that this can only be done if the variable already has a value assigned to it! See below for more information about variables.
This d&d action is used to create your own variables and set values to them. To do this, you must first set the desired variable and the desired value to it in the create event of an object. After that, you then check the Relative box to add the value to the current value of the assigned variable.
Draw Variable
With this action you can draw the value of a variable at a particular position on the screen. Note that this can only be used in the draw event of an object.
This d&d action is used to draw the value of a variable at a certain position on the screen. This action is only effective in the draw event of an object. You must also set the specific object of a draw variable referring to the specific object.
To do this in coding, you must do the same thing for creating variables using this code of a specific object you're referring. For example, obj_player.insertvariablename=value;
For global variables you used this code instead:
global.insertvariablename=value;
draw_text(x,y,"x" + string(obj_insertvariable_name));
The x is there to indicate the stocks of items, score, and lives in platform game elements.
draw_sprite(spr_insertitemname,0,x,y);
This is for drawing the variable of a specific variable to show the current value on the screen.