Page 1 of 1

Need help with my game

PostPosted: Thu Jun 07, 2012 6:31 pm
by Pengaboy
How to create such effect like this:
player moves toward car with speed x=x +0.03 (background moving not player)
now he sits in car and the problem starts here> how to change this speed x=x +0.03 to x=x +0.9
so the car is faster way to travel

Re: Need help with my game

PostPosted: Thu Jun 07, 2012 6:40 pm
by skydereign
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.

Re: Need help with my game

PostPosted: Fri Jun 08, 2012 4:57 am
by Pengaboy
thnx dude that was quiet helpful!
+1
(if know how to put that)(LoL!)
(you got +1)