PDA

View Full Version : How do i make speed controls for a plane?


brucedhammer
09-15-2008, 10:13 AM
How do i make speed controls for a plane? Using one buttun to increase the speed and the other to decrease the speed.

rich0e0rick
09-15-2008, 06:59 PM
i recently added this on my game so i will explain it to you...

first, add 3 variables either in the world properties or on the plane properties, top speed, slow speed, and plane speed...

next make a method in a infinite loop (plane move forward at (plane speed))

next add 2 WHEN A KEY IS TYPED events and change those to WHILE KEY IS PRESSED

for the first event, put in the key u want to use to accelerate, and put in the DURING this

IF (plane plane speed is less than top speed)
increment (plane speed) by 1 , at duration (acceleration speed)(i put 0.25)


for the second event put the key you want to use to slow down and put in the DURING:

IF (plane plane speed is bigger than slow speed)
decrement (plane speed) by 1 , at duration (acceleration speed)(i put 0.25 again)

and that should work!

:D:D rick :D:D

brucedhammer
09-17-2008, 11:20 AM
Thanks that helped out. Good Luck

twopointohaliceuser
11-07-2008, 05:36 PM
Can you show this in picture? I can't seem to get During if part... :confused:

zonedabone
11-10-2008, 10:00 PM
To get a while button is pressed trigger, go through the following steps:


Click "create new event" in the "events" box.
In the drop down menu, click "when a key is typed".
When the trigger appears, right click on it and roll over "change to", then click "While a key is pressed".
If you want something to happen one when the touch is started, put it under "begin". If you want it to happen over and over again while the button is pressed, put it under "during". Put anything you want to happen upon release of the button under "end".

The code should look something like this for speed up and speed down (Events box):
While [1] is pressed
Begin: [NONE]
During: [World.speed down]
End: [NONE] While [2] is pressed
Begin: [NONE]
During: [World.speed up]
End: [NONE]

twopointohaliceuser
11-28-2008, 10:33 PM
What is World.speed down? What do I put there?