Click in Very Center Circle = changes direction of ALL balls
Click in Outside Center Circle = adds a Ball

Changes to Code:
1 - The call to ImpactDebuggingGraphics() has been commented out (perhaps for later removal)
2 - BBnumber set to a beginning value of 1 (there is only a single Bouncing Ball to start)
3 - Created a second center circle for additional input
4 - VeryCenterCircleInput randomizes BB direction (for any and all BB)
5 - CircleInput (the outer center circle, not in the VeryCenterCircle Input) add's a BB A - CreateBB() refactored to work on BBnumber
B - Spent a Good half hour trying to trace down a bug which came from adding the increment to the BBnumber prior to making any arrangements to handle that increment
C - Add var AddBall
D - Add an AddAnotherBall() function to the onFrame() event -- if (AddBall > 1){AddBall();} (I do this as a separate function in the onFrame() (rather than in the onMouseDown(), as the onMouseDown() interupts the onFrame -- or so, I believe -- and this has introduced bugs in the past. Think of it as object management. I'm deciding exactly where and when to add the object.

This is where I'm going to stop for today, as the code has a bug in it that I don't know how to resolve, but I'm pretty sure I know it' it's source. If I create an object onMouseDown(), I'll eventually get an error. Well, I changed the direction of the BB[]'s onMouseDown(), and if they are at the wall, sometimes they sneak through. Try it. Or that is to say, try to line it up right.

And then, much to my dismay, they seem to sneak through at other times, as well...

Also, for my own refererence, if nothing else, I seem to be having difficulties with nesting for statements; that if I call a function that uses a for loop from within a for loop, they both can't use i as the variable. The call function loop will overwrite the value of i. And this, I did not expect.

Previous      Brett Code Index    Next in Series

Octogon Wars 
Copyright © 2013 Brett Paufler