Alice Community Determine Distance Between Two Objects

 Determine Distance Between Two Objects
mbare
Guest

Status:
Posts: n/a
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
 bm-Ch06-E16-doesTheShoeFit.a2w (1.52 MB, 23 views)

mbare
Guest

Status:
Posts: n/a
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
 bm-Ch06-E16-doesTheShoeFit.a2w (1.52 MB, 32 views)

 debussybunny563 Senior Member     Status: Offline Posts: 852 Join Date: May 2010 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.
mbare
Guest

Status:
Posts: n/a
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
 distanceImage.jpg (49.0 KB, 81 views)

 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 09-21-2010, 12:49 AM There's a "round" function under the world's functions. Use that.

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge