Alice Community  

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

Reply
 
Thread Tools Display Modes
Random list object movement
Old
claudiaj
Guest
 
Status:
Posts: n/a
Default Random list object movement - 02-13-2010, 04:13 PM

I have a list of x objects, and wish to make each one move .5 meter only. I've created the move method, placed the list variable as the object to move, and chosen getRandomItem, but haven't figured out how to set the boolean for each item in the list so after it's moved, it's changed to false and doesn't move again. This was suggested by my instructor, but without full directions as to how to do it. If there is another, perhaps better way to accomplish this, I'm open to suggestions! Thanks!
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 02-13-2010, 05:23 PM

Does the order that the objects move in have to be random, or can it be a set order? If it can be a set order, use the for all in order method, using your object list as the argument. Then have object from list move forward .5 meters.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
claudiaj
Guest
 
Status:
Posts: n/a
Default 02-13-2010, 05:43 PM

yes, the order must be random. I'm trying to make a whack-a-mole game, and the moles have to appear randomly. It was suggested I use a boolean array to check for true/false on each mole, so after one moved, it would switch to false and not move again. or wait a moment and move back down. I can't figure out how to do that. Everything I've tried hasn't worked so far.

They also need to react to being bopped, which I think can be handled through a new event.

This hasn't been covered in the textbook. It's a bit more advanced. If you know how to do this, I'd really appreciate your input. Thanks!
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 02-13-2010, 06:12 PM

Quote:
Originally Posted by claudiaj View Post
yes, the order must be random. I'm trying to make a whack-a-mole game, and the moles have to appear randomly. It was suggested I use a boolean array to check for true/false on each mole, so after one moved, it would switch to false and not move again. or wait a moment and move back down. I can't figure out how to do that. Everything I've tried hasn't worked so far.

They also need to react to being bopped, which I think can be handled through a new event.

This hasn't been covered in the textbook. It's a bit more advanced. If you know how to do this, I'd really appreciate your input. Thanks!
Claudiaj, you didn't mention which text book it is mentioned in that you are using for your class. However the project you are attempting to do is included in the text by Dann, Cooper and Pausch - it's on page 239. They are attempting to teach you how to use a List structure. You might wish to re-read from the text.

Good luck.
   
Reply With Quote
Old
claudiaj
Guest
 
Status:
Posts: n/a
Default 02-13-2010, 07:52 PM

My textbook is Alice in Action, by Joel Adams. I've looked for help with manipulating lists, and found very little so far. I'm still hoping someone here can help? Thanks.
   
Reply With Quote
Old
Veryuhbull
Guest
 
Status:
Posts: n/a
Default 02-13-2010, 08:23 PM

You could make an object varible and make it a list and include x objects. then say for all in order expression list with x move 5 meters. I don't think this is random though.
   
Reply With Quote
Old
claudiaj
Guest
 
Status:
Posts: n/a
Default 02-13-2010, 10:16 PM

Thanks to all for trying to help me. I think I need professional help! lol! I'm giving up for now.
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.