Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Random Jumping Objects (http://www.alice.org/community/showthread.php?t=11535)

chellydee 07-24-2016 09:17 PM

Random Jumping Objects
 
I'm working on an Alice World, where my objects need to jump at a random height. I figured out how to make objects go up with random in the method, but I can't figure out how to make the object come back down the same exact height randomly chose.
Please help

chickentree 07-25-2016 12:52 AM

[QUOTE=chellydee;57239]I'm working on an Alice World, where my objects need to jump at a random height. I figured out how to make objects go up with random in the method, but I can't figure out how to make the object come back down the same exact height randomly chose.
Please help[/QUOTE]

My suggestion would be to write a jump method that takes a numeric parameter and uses it to jump up and down.
Then in your "my fist method" create a loop. Each time you go through the loop:
1. Generate a new random number.
2. Call your jump method using the new random number.

Mark

chellydee 07-31-2016 12:44 PM

[QUOTE=chickentree;57240]My suggestion would be to write a jump method that takes a numeric parameter and uses it to jump up and down.
Then in your "my fist method" create a loop. Each time you go through the loop:
1. Generate a new random number.
2. Call your jump method using the new random number.

Mark[/QUOTE]

Thanks...that helped a lot.


All times are GMT -5. The time now is 11:06 PM.

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