|
|
|
|
|
|
|
|
Junior Member
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
|
Buoy List, Boooyyyyy. -
01-11-2014, 06:20 PM
"To determine when the game is over, you need a way to know when all the buoys have been picked up. To track the buoys that have been picked up, create a second world-level list, this one named picked UpBuoys and leave it empty. In the pickUpBuoy method, create a statement that adds the picked up buoy to the pickedUpBuoys list. Create a world-level method named checkIfGameIsOver and call it every time a buoy is picked up. When the size of pickedUpBuoys is equal to seven, the player wins the game and a 3D text object is used to display "You did it!".
Taken from Learning to program with Alice, 3rd Ed. by Wanda P Dann, Stephen Cooper, and Randy Pausch.
So, here's the issue. I've completed the majority of the assignment. Now comes the tricky part, I need to be able to add a +1, to the pickedUpBuoys list whenever I pick up a buoy, and this is driving me insane. Where is my program going wrong, I'd like some perspective, not a laid out list of what to do.
|
|
|
|
|
Senior Member
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
|
You might have misinterpreted the instructions. -
01-12-2014, 05:42 PM
I don't have a copy of the book, but the instructions would seem to indicate that two object lists are needed. One for the unfound allBouys, and one for the pickedUpBouys.
When a picked new bouy is encountered, it is to be removed from allBouys, and added to pickedupBouys. Eventually the size of the second list will equal 7.
Also, if you are using 2.4.1, the "while world is running" event might be broken.
|
|
|
|
|
Junior Member
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
|
01-13-2014, 05:41 PM
See, but I'm trying exactly that, but it doesn't give me the options. Presumably, I'm not doing the correct function.
Every time I try to remove from one list, and add to the other list, I don't know how to indicate at what position in the list that the item from allBuoys needs to go to. It always ends up putting a value of 1,1,1,1,1,1,1,1, etc. once I just pick up one buoy. I can't figure out the correct syntax to add/remove.
|
|
|
|
|
Senior Member
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
|
Hmm? -
01-14-2014, 11:52 AM
Quote:
Originally Posted by gballa1993
See, but I'm trying exactly that, but it doesn't give me the options. Presumably, I'm not doing the correct function.
Every time I try to remove from one list, and add to the other list, I don't know how to indicate at what position in the list that the item from allBuoys needs to go to. It always ends up putting a value of 1,1,1,1,1,1,1,1, etc. once I just pick up one buoy. I can't figure out the correct syntax to add/remove.
|
Try looking at your list definitions again. They both need to be "Object" lists for it to work.
|
|
|
|
|
Junior Member
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
|
01-14-2014, 02:36 PM
The only options it gives me when I choose for
If item_from_allBuoys.vehicle == sailboat
(insert correct statement)
The only options it gives me regarding the list are in this screenshot. And if I choose those, when I pick up a buoy, it continues adding that object, similar to the 1,1,1,1,1,1,etc.
Last edited by gballa1993; 01-14-2014 at 02:38 PM.
Reason: Didn't realize the jpeg would show up
|
|
|
|
|
Super Moderator
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
|
Stop! You are not reading what you think you are. -
01-15-2014, 08:20 AM
Of course this has never happened to ME, but I believe you are thinking your setup is basically correct and not carefully reading the responses.
You are meant to have two list of buoys one full and the other empty. Your second list is either not a list or not a list of buoys, if it was a list of buoys the results would not be 1,1,1, ... Due to the resolution I can not see the code in your attached picture and so can not be sure about what you are doing. I have however attached a movie that will show you the basic idea.
Hope this helps,
Mark
Mark Henwood
mhenwood@ieee.org
|
|
|
|
|
Senior Member
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
|
The image was a little hard to Read -
01-15-2014, 12:17 PM
But you are making progress.
Once you have identified an item in the first list, you can:
1) Add the list item to the (beginning or end) of a hit list.
2) Delete it from the original list so it can't be found again.
3) Perform whatever tasks need to be accomplished using the new hit list entry. To program the actions like turn or go invisible, you must first drag in the command using one of the original objects, then drag the array name in, and replace the original object name with appropriate list position.
If the first list becomes empty, you're done.
Last edited by MrMoke; 01-15-2014 at 01:08 PM.
Reason: Added Image
|
|
|
|
|
Junior Member
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
|
Ahhhhhhh! -
01-15-2014, 06:51 PM
I am so thick-skulled! Haha, thank you both very much, that actually makes much more sense now that I took a step back and looked at what I was actually trying to accomplish. If I do a
Do in order
If item_from_allBuoys.vehicle==sailboat
Add item_from_allBuoys.list to beginning of pickedUpBuoys.list
Remove item_from_allBuoys.list from allBuoys.list
Else
Do nothing
Does that sound fairly accurate?
I ask because my computer actually just took a dive, and I may have to re-image the hard drive. So..yay, starting over!
|
|
|
|
|
Senior Member
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
|
Ok -
01-16-2014, 08:19 AM
I guess that would work as long as the item has already been attached to the sailboat somewhere else in the program.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.
|
|