Alice Community  

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

Reply
 
Thread Tools Display Modes
Determine Distance Between Two Objects
Old
mbare
Guest
 
Status:
Posts: n/a
Default Determine Distance Between Two Objects - 09-18-2010, 05:05 AM

Is there a way to ask Alice the starting distance between two objects.

I am trying to get an "If True" statement to work, but I believe it is not working properly because I do not know the starting distance between the two objects.

The two objects are the prince and Cinderella and is attached below.
Attached Files
File Type: a2w bm-Ch06-E16-doesTheShoeFit.a2w (1.52 MB, 23 views)
   
Reply With Quote
Old
mbare
Guest
 
Status:
Posts: n/a
Talking 09-18-2010, 06:39 AM

I was able to work the exercise. But I'm still interested in if there is a way to have determine the distance between two objects.
Attached Files
File Type: a2w bm-Ch06-E16-doesTheShoeFit.a2w (1.52 MB, 32 views)
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Arrow 09-18-2010, 08:56 AM

Go under any object's functions, and there should be a "distance to" function.

Then make a number variable, and in the method set its value to the object's distance to the other object.

Then you could have someone in the world say that variable as a string.


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.
   
Reply With Quote
Old
mbare
Guest
 
Status:
Posts: n/a
Default 09-20-2010, 10:10 PM

Thank you for your help debussybunny563. On this week's exercise I was able to have the ladybug say how far away the frog was. But the decimal places are excessive. Is there a way to have only say "X.X meters" instead of the 15 numbers that show?
Attached Images
File Type: jpg distanceImage.jpg (49.0 KB, 81 views)
   
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 09-21-2010, 12:49 AM

There's a "round" function under the world's functions. Use that.
   
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 ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.