Some anomalies driving me nuts...
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I'm a rookie at this stuff, so I'm still wallowing my way through. The following code for the perennial BouncingBalls assignment results in some anomalies that I can't figure out.
The main problem is that there SEEM TO BE different responses: the balls reverse direction at the right and bottom, but
not top and left. In the code I have shown two different statements: one for dir_x, (which seems like it should work, but
doesn't) and the one for dy, (which reverses direction properly, but the d? value is not the one that I want to change,
only the direction modifier needs to change.)
The dir_x one is the one that I think should work, but the dy variation provides reversal. Since both variables are in the
same formula, I can't figure out why one works, one doesn't.
The other anomaly is that Ball4 doesn't behave as the other three. What the hell's going on.....a tribute to Jim Bouton???
Any suggestions on where to start looking for the bugs would be appreciated.
Thanks.
Here's the code:
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ November 24, 2002: Message edited by: Dirk Schreckmann ]
The main problem is that there SEEM TO BE different responses: the balls reverse direction at the right and bottom, but
not top and left. In the code I have shown two different statements: one for dir_x, (which seems like it should work, but
doesn't) and the one for dy, (which reverses direction properly, but the d? value is not the one that I want to change,
only the direction modifier needs to change.)
The dir_x one is the one that I think should work, but the dy variation provides reversal. Since both variables are in the
same formula, I can't figure out why one works, one doesn't.
The other anomaly is that Ball4 doesn't behave as the other three. What the hell's going on.....a tribute to Jim Bouton???
Any suggestions on where to start looking for the bugs would be appreciated.
Thanks.
Here's the code:
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ November 24, 2002: Message edited by: Dirk Schreckmann ]
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Clue: the direction of a ball should be part of the
ball's state. You are using local variables to
hold the direction.
-Barry
ball's state. You are using local variables to
hold the direction.
-Barry
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Mark Buntain
Greenhorn
Posts: 3
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thank You very much Barry.
That's all it took, move two lines of code.
That's all it took, move two lines of code.
| A feeble attempt to tell you about our stuff that makes us money The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |






