Alice Community  

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

Reply
 
Thread Tools Display Modes
Stopping a moving object with a switch
Old
Mac1357642
Junior Member
 
Status: Offline
Posts: 2
Join Date: Jul 2020
Default Stopping a moving object with a switch - 08-02-2020, 01:33 PM

I'm trying to make a stop moving when the mouse clicks the red button. I got it to drive when the green button is clicked but can not get it to stop with the red button. It just finishes it's rotation of the track. Can anyone help?
   
Reply With Quote
Using a Boolean variable to control action
Old
djslater107
Administrator
 
Status: Online
Posts: 163
Join Date: Jan 2007
Default Using a Boolean variable to control action - 08-03-2020, 12:29 PM

Create a boolean world variable, set it to false, and name it something like isActive.

You probably have a while loop controlling the drive around the track. That loop should be
while isActive
drive

When you click on the green button set the isActve variable to true

When you click on the red button, set the isActive button to false


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