Alice Community Random Direction

 Random Direction
 Laur07 Junior Member   Status: Offline Posts: 11 Join Date: Jun 2011 Random Direction - 06-11-2011, 10:32 PM Hey, for my project i need to make my person move in a random direction, I know how to make it move a random distance but I am struggling with the direction, does anyone know how to do this ? Thank you !
David B
Senior Member

Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
06-12-2011, 12:23 AM

Quote:
 Originally Posted by Laur07 Hey, for my project i need to make my person move in a random direction, I know how to make it move a random distance but I am struggling with the direction, does anyone know how to do this ? Thank you !
This probably isn't the best way, but it should work, and was the first idea that came to mind. What don't you have Alice select a random number, and then have an if/else method that basically says that if the random number equals this then have the person turn this direction, otherwise, have him turn this direction. You could also put an if/else loop within an if/else loop to make the randomization even more random. I hope this helps!

 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 06-12-2011, 07:05 AM Or you could use the "Choose true" function and have it "choose left" within an if/else 25% of the time, right, forward, and back. So something like this IF choose true (25%) Person move forward ELSE IF Choose true (25%) person move left ELSE IF Choose true (25%) person move backward ELSE person move right -------------------------------------------------------------------------------------------------------------------------- I have plenty of common sense. I just choose to ignore it. -Calvin and Hobbes Wondering about my Avatar? http://en.wikipedia.org/wiki/Tardigrade Wondering about my username? http://www.youtube.com/watch?v=jG7vhMMXagQ
David B
Senior Member

Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
06-12-2011, 09:02 AM

Quote:
 Originally Posted by TauTrumpsPi Or you could use the "Choose true" function and have it "choose left" within an if/else 25% of the time, right, forward, and back. So something like this IF choose true (25%) Person move forward ELSE IF Choose true (25%) person move left ELSE IF Choose true (25%) person move backward ELSE person move right
I didn't understand any of that, which is probably why I didn't think of it.

 ElectricKirby Senior Member     Status: Offline Posts: 164 Join Date: May 2011 Location: Dreamland, Planet Popstar 06-12-2011, 09:12 AM Make a list with all six directions in it, then drag the list to wherever you need a random direction, and select random_item_from_world.nameOfList My Favorite Resources: Uploading Images - http://tinypic.com/ File Sharing - http://www.4shared.com/ Textures - http://www.filterforge.com/ Convertible Game-Ripped Models - http://models-resource.com/ Music - http://www.brawlcustommusic.com/gamelist
DensetsuNoKaboom
Senior Member

Status: Offline
Posts: 1,188
Join Date: May 2010
Location: e4eaf2
06-12-2011, 11:28 AM

Quote:
 Originally Posted by tautrumpspi or you could use the "choose true" function and have it "choose left" within an if/else 25% of the time, right, forward, and back. So something like this if choose true (25%) person move forward else if choose true (33.3%) person move left else if choose true (50%) person move backward else person move right
correctiooooooon!!!

Thank you for taking the time to read this signature. This signature loves you.

David B
Senior Member

Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
06-12-2011, 02:05 PM

Quote:
 Originally Posted by DensetsuNoKaboom correctiooooooon!!!
What did you mean by that post?

 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 06-12-2011, 04:04 PM I think I get what he is trying to say. Since this a random chance without replacement, you can't just have the first one at 25% and continue from there. After you rule out the first one, there are only 3 left, so you need the next one to be at 33%. Then 2 left, so 50%, then 1 left, 100%. Thanks for the correction. Though I do think that ElectricKirby's idea is the easiest, now that I see it. -------------------------------------------------------------------------------------------------------------------------- I have plenty of common sense. I just choose to ignore it. -Calvin and Hobbes Wondering about my Avatar? http://en.wikipedia.org/wiki/Tardigrade Wondering about my username? http://www.youtube.com/watch?v=jG7vhMMXagQ
 Laur07 Junior Member   Status: Offline Posts: 11 Join Date: Jun 2011 06-12-2011, 04:34 PM Thank you for your responses, i will give it a try later i hope it works Thanks so much!

 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