Alice Community  

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

Reply
 
Thread Tools Display Modes
Random Jumping Objects
Old
chellydee
Junior Member
 
Status: Offline
Posts: 9
Join Date: Jul 2016
Exclamation Random Jumping Objects - 07-24-2016, 09:17 PM

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
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 07-25-2016, 12:52 AM

Quote:
Originally Posted by chellydee View Post
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
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


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Old
chellydee
Junior Member
 
Status: Offline
Posts: 9
Join Date: Jul 2016
Default 07-31-2016, 12:44 PM

Quote:
Originally Posted by chickentree View Post
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
Thanks...that helped a lot.
   
Reply With Quote
Reply

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