Quote:
Originally Posted by stupidmonkey
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.
|
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;
}
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
}
That's the basics of it at least, good luck! (: