Can you describe what the messed part is now? After a few code changes, it could be acting differently than it was.Quote:
why the out put is messed when the for loop is in place
Printable View
Can you describe what the messed part is now? After a few code changes, it could be acting differently than it was.Quote:
why the out put is messed when the for loop is in place
it seems that the ball is containd on one side of the page the balls see as tho they are not flowing more like traped on one side
Back to printing out the values of the balls positions. Only test with two balls to keep it simple. You might try changing the size of the window and the speed that the balls move for easier debugging.Quote:
like traped on one side
The thing to notice is when the ball reverses direction. What variables are used when a ball reverses direction?
it must be something to do with the for loop because all varibles are the same with and without it and when i put a break; after the while the balls work perfectley hmmmm this is deffonatley a strange one
You can make assumptions and/or you can add printlns and look at the output and see if there is a pattern when a ball looks like it is "trapped on one side".
What are the values of the balls positions when that happens?
here is a print out of the posision
x = 758 y = 547
x = 50 y = 524
x = 757 y = 548
x = 49 y = 525
x = 756 y = 549
x = 48 y = 526
x = 755 y = 550
x = 47 y = 527
x = 754 y = 551
x = 46 y = 528
x = 753 y = 552
x = 45 y = 529
x = 752 y = 553
x = 44 y = 530
x = 751 y = 554
x = 43 y = 531
x = 750 y = 555
x = 42 y = 532
x = 749 y = 556
x = 41 y = 533
x = 748 y = 557
x = 40 y = 534
x = 747 y = 558
x = 39 y = 535
x = 746 y = 559
x = 38 y = 536
x = 745 y = 560
x = 37 y = 537
x = 744 y = 561
x = 36 y = 538
x = 743 y = 562
x = 35 y = 539
x = 742 y = 563
x = 34 y = 540
x = 741 y = 564
x = 33 y = 541
x = 740 y = 565
x = 32 y = 542
x = 739 y = 566
x = 31 y = 543
x = 738 y = 567
x = 30 y = 544
x = 737 y = 568
x = 29 y = 545
x = 736 y = 569
x = 28 y = 546
x = 735 y = 570
x = 27 y = 547
X:\Desktop\Programing Resit#\tests\bb2\test 2\test3>
thats just for one ball
And I assume that the one balll moved as expected. Is that correct?
Now run the test with two balls.
Did you read post#30?
one ball is moving strange too as the print out shows it seems to be on the x axis, i saw post #30 yeah i am going to chenge the window size now
found the problem
for (int i=0; i<opc;i++){
insted of
for (int i=0; i<=opc;i++){
now the balls are moving the same way at the same speed
One more bug out. Maybe three left.
Then a big redesign.
haha yeah thankyou so much for helping me with this :) i am most greatfull
Ok, Good luck.
thanks mate :)