Need help with my game

Non-platform specific questions.

Need help with my game

Postby Pengaboy » Thu Jun 07, 2012 6:31 pm

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
If everything is possible, then its possible that something is impossible!
LoL!

Creating Games Is Art R E S P E C T I T !!!
http://i43.servimg.com/u/f43/13/13/31/96/displa10.gif
User avatar
Pengaboy
 
Posts: 34
Joined: Wed Jun 06, 2012 11:24 am
Location: somewhere in my dreams
Score: 1 Give a positive score

Re: Need help with my game

Postby skydereign » Thu Jun 07, 2012 6:40 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Need help with my game

Postby Pengaboy » Fri Jun 08, 2012 4:57 am

thnx dude that was quiet helpful!
+1
(if know how to put that)(LoL!)
(you got +1)
If everything is possible, then its possible that something is impossible!
LoL!

Creating Games Is Art R E S P E C T I T !!!
http://i43.servimg.com/u/f43/13/13/31/96/displa10.gif
User avatar
Pengaboy
 
Posts: 34
Joined: Wed Jun 06, 2012 11:24 am
Location: somewhere in my dreams
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest