- Want to learn Game Editor, start here
Index
- • Variables
• Add, Subtract, multiply, devide
• Displaying the number of a variable
• Using a sprite sheet
• Making our character walk
• Gravity
• Physical Response
• Jumping
• Displaying messages
• Making the screen follow the character
• Create actor at set x and y
• Wireframe, canvas and filled regions
Variables
There are many types of variables
int
double
float
char
and many more. an INT variable can't have numbers such as .9, while double and float can both contain .9 numbers.
Char variables contain text. You can use these variables by either making them in Global code, or by clicking "Variables" located when making a script.
- Code: Select all
int variable;
double variable;
float variable;
char variable[255];
As you can see, the char variable is a bit different, char variables use either a * before the name, or a [number] after the name, this means that the text can only contain 255 characters in that variable. A * can contain infinity.
Adding, subtracting, multiplying and dividing
Too add, subtract, multiply, or divide a variable, you will have to use these symbols
+ - * /
+ is add, - is subtract, * is multiply and / is devide
In a script, it would look like this
- Code: Select all
y = y + 1;
y = y - 1;
y = y * 1;
y = y / 1;
How do I create a variable that dosn't go below 0?
If you wan't to make a variable that dosn't go below 0, then you have to make a script that prevents it from subtracting ocne it reaches 0. This can be done using this method
- Code: Select all
if (variable>0)
{
variable = variable - 1;
}
When the variable reaches 0, it will stop subtracting
This tutorial will continue later on