Alice Community

Alice Community (
-   How do I...? (
-   -   How do i make speed controls for a plane? (

brucedhammer 09-15-2008 09:13 AM

How do i make speed controls for a plane?
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 05:59 PM

try this
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 10:20 AM

Thanks that helped out. Good Luck

twopointohaliceuser 11-07-2008 04:36 PM

Can you show this in picture? I can't seem to get During if part... :confused:

zonedabone 11-10-2008 09:00 PM

To get a while button is pressed trigger, go through the following steps:
[LIST=1][*]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".[/LIST]The code should look something like this for speed up and speed down (Events box):
[code]While [1] is pressed
Begin: [NONE]
During: [World.speed down]
End: [NONE][/code][code] While [2] is pressed
Begin: [NONE]
During: [World.speed up]
End: [NONE][/code]

twopointohaliceuser 11-28-2008 09:33 PM

Still confused...
What is World.speed down? What do I put there?

All times are GMT -5. The time now is 01:36 AM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.