Alice Community How to have "number of" from a list of objects?

 How to have "number of" from a list of objects?
 aliceguyyowat Guest   Status: Posts: n/a How to have "number of" from a list of objects? - 10-22-2009, 11:59 AM I'm trying to have it so that I can make a function that asks if a number of items from a list of objects are within distance of some other object. For example, I have a variable with a list of penguin objects. They are all 5 meters away from this other object, a snowman for example. I'm going to have all of these penguin objects move forward towards the snowman, however I'd like it so only 3 are within 3 meters of the snowman. There can't be the entire set of penguins within 3 meters. So how can I put a limit to the number of objects from a list doing something?
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 10-22-2009, 01:44 PM What exactly are you trying to get done? Are all 5 penguins supposed to move towards the snowman and only 3 of them stop (because only those 3 are close enough to the snowman) or are only 3 of them supposed to ever move? (')>
 aliceguyyowat Guest   Status: Posts: n/a 10-22-2009, 02:03 PM What exactly are you trying to get done? Are all 5 penguins supposed to move towards the snowman and only 3 of them stop (because only those 3 are close enough to the snowman) ^ This.
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 10-22-2009, 10:55 PM Try this: Loop infinity times For all all world.penguins one item_from_penguins at a time If item_from_penguins is at least 3 meters away frm snowman Item_from_penguins move forward .1 meters duration = 0 seconds Else Do nothing I tested this method with three penguins and a lemur, and it worked pretty well. (')>

 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 General Discussion     Questions and Comments     The Lounge