You can use a variable for this. A variable can hold a number or value in your game. In your case you want to store the speed the background moves.
- Code: Select all
x=x+bg_speed; // bg_speed is the variable
Variables' default value is 0, so you'll need to set it to 0.03 when the background is created.
- Code: Select all
bg_speed=0.03;
Now, whenever you want to change speed, you can by setting bg_speed equal to something else. For instance you wanted to speed the bg movement up.
- Code: Select all
bg_speed=0.9;
To create a variable, go into the script editor.
At the bottom click [Variables].
Click [Add].
Give the variable a name, for instance bg_speed.
In your case bg_speed needs to be able to hold floating point values (non-integer values), so click Integer and change it to Real. From there click add at the bottom. After that the variable should be created, and be functional in your game.