Alice Community  

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

Reply
 
Thread Tools Display Modes
Circle Track
Old
TaraLaukart
Guest
 
Status:
Posts: n/a
Default Circle Track - 02-24-2010, 08:43 PM

How do I make an object stop moving?

I have an object moving on a loop when I click a button and I need it to stop when I click the other button.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 02-24-2010, 09:11 PM

Try using a boolean variable which sets itself to true when the go button is clicked and to false when the stop button is clicked. Then use the boolean with a while loop to let the loop stop when the variable is false.

Be sure there's something that calls the method with the while loop in it, though. Otherwise, the object won't move whether it's true or not.


(')>
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 02-25-2010, 07:33 AM

Quote:
Originally Posted by TaraLaukart View Post
How do I make an object stop moving?

I have an object moving on a loop when I click a button and I need it to stop when I click the other button.

In my words

Make a boolean like X said
Make the loop
Put the loop in a if/else statement
Make sure its at false in the "true" section
make it so when you click the button the false sets to true
So if you if you click the button, if the boolean is treu, it will stop

If you want me to make an example. Ill do it in 5 minutes ok


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Reply

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 ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.