Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Help with Project?
Old
stupidmonkey
Junior Member
 
Status: Offline
Posts: 1
Join Date: Dec 2012
Default Help with Project? - 12-18-2012, 12:12 PM

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.
   
Reply With Quote
Old
HaloMike117
Junior Member
 
Status: Offline
Posts: 8
Join Date: Dec 2012
Default 12-18-2012, 02:01 PM

Quote:
Originally Posted by stupidmonkey View Post
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! (:

Last edited by HaloMike117; 12-18-2012 at 02:07 PM.
   
Reply With Quote
Reply

Tags
alice 2.0

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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