Alice Community  

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

Reply
 
Thread Tools Display Modes
Chapter 7 Excercise 8, Speed Control
Old
LuisN
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2010
Location: Arizona
Default Chapter 7 Excercise 8, Speed Control - 04-16-2010, 03:50 PM

This is very confusing. I try to use loops with infinity but when I click on the medium button it just makes it go faster and faster. I am not completely sure what to do and how to do it.

Also, how the heck do you make things stop! When I use a while loop it just keeps going and going and that's cool, but how do I make them stop, I have tried every FREAKING possible way, I swear to god I will go mad, :/. No one else has been able to get it, well thanks for the help .
   
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 04-16-2010, 07:39 PM

I bet you just put your while statement in a method that only gets called once. It must be called constantly in order to be constantly updated on the state of it's conditional argument.

Here's an example world with a bunny that turns left when the Space key is pressed, then stops when it's pressed again. The reason it does this is because there are actually TWO while statements at work: the one which directly spins the rabbit if the variable is true, and the one that constantly calls the spinMethod while the world is running (in the event window).
Attached Files
File Type: a2w WhileExample.a2w (313.9 KB, 108 views)


(')>
   
Reply With Quote
Old
LuisN
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2010
Location: Arizona
Default 05-12-2010, 11:35 AM

Quote:
Originally Posted by x2495iiii View Post
I bet you just put your while statement in a method that only gets called once. It must be called constantly in order to be constantly updated on the state of it's conditional argument.

Here's an example world with a bunny that turns left when the Space key is pressed, then stops when it's pressed again. The reason it does this is because there are actually TWO while statements at work: the one which directly spins the rabbit if the variable is true, and the one that constantly calls the spinMethod while the world is running (in the event window).
Thanks!
   
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 ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.