Alice Community  

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

Reply
 
Thread Tools Display Modes
Recursion
Old
schlep
Guest
 
Status:
Posts: n/a
Default Recursion - 11-30-2007, 08:45 PM

Basically, I'm creating a shoot out b-ball game. I have a list of 5 balls and I have the user hitting space bar to pick up the ball and assume shooting position, then S to actually shoot the ball into the net. I can't seem to have the list STOP until every ball has gone through the method. is there anyway that I can make my program so that the user has to hit the button everytime to make the b-ball player assume the position and hit S everytime to shoot each different ball? I've been going through the textbook like crazy and can't find a solution.
   
Reply With Quote
Old
marriott
Guest
 
Status:
Posts: n/a
Default 12-01-2007, 10:10 PM

Quote:
Originally Posted by schlep View Post
Basically, I'm creating a shoot out b-ball game. I have a list of 5 balls and I have the user hitting space bar to pick up the ball and assume shooting position, then S to actually shoot the ball into the net. I can't seem to have the list STOP until every ball has gone through the method. is there anyway that I can make my program so that the user has to hit the button everytime to make the b-ball player assume the position and hit S everytime to shoot each different ball? I've been going through the textbook like crazy and can't find a solution.
I'm not sure how you'd use recursion to solve this problem in a straighforward manner. I particularly can't make sense of: "I can't seem to have the list STOP until every ball has gone through the method."

I would use a variable to track the state of the player (does he have the ball in his hand?) and a variable to track the number of balls that have been shot. If I'm picturing your game idea correctly, I think that would be enough information to track the state of your program.
   
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 ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.