Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Help with Project? (http://www.alice.org/community/showthread.php?t=9798)

stupidmonkey 12-18-2012 12:12 PM

Help with Project?
 
Choose a ride object other than the carousel from the Amusement Park gallery that moves in a circular pattern (a round-and-round matter, like the Ferris wheel). Create a method that performs an animation appropriate for the ride object selected. Then, create a way to start and stop the ride using the While something is true event.

How do you make the selected object stop using a while command?

^_^ Examples will be appreciated.

HaloMike117 12-18-2012 02:01 PM

[QUOTE=stupidmonkey;52000]Choose a ride object other than the carousel from the Amusement Park gallery that moves in a circular pattern (a round-and-round matter, like the Ferris wheel). Create a method that performs an animation appropriate for the ride object selected. Then, create a way to start and stop the ride using the While something is true event.

How do you make the selected object stop using a while command?

^_^ Examples will be appreciated.[/QUOTE]

Simple!

Add a new object, like a button. Create a property for the button (activated - true/false). Then, create a method to turn the switch on or off. Something simple such as:
[CODE]
//Turns the button on and off
void changeButtonStatus()
{
//Checks to see if the button is currently on
//If the button is on, it is turned off
//If the button is off, it is turned on
if(button.activated == true)
{
//Button is on, so we turn it off
button.color = red;
button.activated = false;
} else {
//Button is off, so we turn it on
button.color = green;
button.activated = true;
}
[/CODE]

Call the method when the button is clicked (using an event).

Now, all you need to do is set the while statement to:
[CODE]
//While the button is on, let the ride run.
while(button.activated == true)
{
ride.run();
} else {
//Do Nothing
}
[/CODE]

That's the basics of it at least, good luck! (:


All times are GMT -5. The time now is 07:17 AM.

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