Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Creating a spinner (http://www.alice.org/community/showthread.php?t=11118)

MrMoke 05-10-2015 05:23 PM

Or- Don't be a Poser
 
1 Attachment(s)
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 :eek:

john316 05-10-2015 05:55 PM

Thank You
 
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.

MrMoke 05-11-2015 08:06 AM

The number that's passed back is the multiplier.

RavenOfCode 05-11-2015 05:21 PM

[QUOTE=MrMoke;56182]The number that's passed back is the multiplier.[/QUOTE]

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...

offbraxton 02-18-2020 01:10 PM

Can I get a repost?
 
I am helping my son learn to code and this project has us stumped could I get a reupload of the file so I can make sense of it and show him?


All times are GMT -5. The time now is 08:18 PM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.