Alice Community  

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

Reply
 
Thread Tools Display Modes
Or- Don't be a Poser
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 500
Join Date: Sep 2007
Location: Austin, Texas
Wink Or- Don't be a Poser - 05-10-2015, 05:23 PM

Just remember that poses are not always an efficient solution to a programming algorithm, and that there are many other viable solutions. The attached proggie uses only a single array, and the positions of the objects in the array to generate a random number of steps.

I left a key item visible so that you could see what's going on, but it can easily be made invisible. There is also no need for a function because the stepcount variable is global.

The two code blocks are disabled, so you can enable the first to view it, then disable it and enable the second to run the test.

Collisions are sometimes good for you
Attached Files
File Type: a2w spinner.a2w (337.6 KB, 3 views)
   
Reply With Quote
Thank You
Old
john316
Junior Member
 
Status: Offline
Posts: 10
Join Date: Apr 2015
Default Thank You - 05-10-2015, 05:55 PM

Thanks for the help. Thank you for being so patient. 1 last question. Because the boy will be on a game board he needs to move each square. To land in the middle of each square he must move .31 meters. How do I set it so so that he will that distance( .31 meters) ''x'' amount of times (whatever number the spinner lands on) ?

Thanks again.
   
Reply With Quote
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 500
Join Date: Sep 2007
Location: Austin, Texas
Default 05-11-2015, 08:06 AM

The number that's passed back is the multiplier.
   
Reply With Quote
Old
RavenOfCode
Senior Member
 
RavenOfCode's Avatar
 
Status: Offline
Posts: 407
Join Date: Oct 2013
Location: Northern Virginia
Default 05-11-2015, 05:21 PM

Quote:
Originally Posted by MrMoke View Post
The number that's passed back is the multiplier.
ie: .31 * spins (or whatever variable you are using).

Also Mr. Moke your example is really a creative idea... I like your use of arrays...


Stuff + Other Stuff + Different Other Stuff = Things :)

My best Alice game:

Clash of the Cubes (an arena fighting game):
http://www.alice.org/community/showthread.php?t=10738&highlight=game

Last edited by RavenOfCode; 05-12-2015 at 06:08 AM.
   
Reply With Quote
Reply

Tags
spinner

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