Alice Community  

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

Reply
 
Thread Tools Display Modes
setting the distance by asking the user
Old
Sharris
Member
 
Status: Offline
Posts: 15
Join Date: Jan 2014
Default setting the distance by asking the user - 03-10-2014, 10:15 AM

I am doing Alice assignment Lab 1 and, I have to pick a hopping animal and have him hop by the distance asked by the user. The only trouble I am having is letting the user set how far the animal can walk. I used a kangaroo by the way. Can someone please help me? Thank you.
   
Reply With Quote
Ok
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Ok - 03-11-2014, 06:56 PM

1) Create a numeric variable.
2) Drag a "set variable value" into you main program, and set it to "1".
3) Click on World functions, and drag a "Ask user for a number" into the "1".
4) Create a numeric "parameter" in your hop routine.
5) pass the outside variable name in as a parameter when calling your the hop routine.

Last edited by MrMoke; 03-11-2014 at 06:58 PM.
   
Reply With Quote
Thank you.
Old
Sharris
Member
 
Status: Offline
Posts: 15
Join Date: Jan 2014
Default Thank you. - 03-12-2014, 12:41 PM

It worked, Thank you for your help.
   
Reply With Quote
input distance
Old
levimrj
Junior Member
 
Status: Offline
Posts: 11
Join Date: Jan 2014
Location: Dallas, TX
Default input distance - 03-27-2014, 11:38 AM

I had a little trouble with this also. I followed the tutorial on variables and functions and was able to get it to work. I also used the example in the book about a hopping frog. I used the roo for this assignment also.
   
Reply With Quote
Reply


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