05-18-2026, 03:51 AM
(This post was last modified: 05-18-2026, 04:59 AM by 1micha.elok.)
(05-17-2026, 10:20 AM)kevin Wrote: Hi, I am having a quick look at the code. However, I just noticed another little bug - when you add a second ball the first one disappears? I think this only happens the first time a ball is added.
I will have a look at this also, but I will probably have more time tomorrow. Please let us all know if anyone makes any progress on this.
All the best - Kevin.
edit - The disappearing ball is fixed by adding this line after the first ball is created at about line 30:
ballCount = ballCount + 1
Thank you, I'm really glad you found the solution. I completely missed that line. This week, I'm continuing to work through the code to figure out a couple of other bugs.

For performance issue, I think this additional code to remove out-of-bounds balls will solve it...let's see....
Code:
' balls
foreach ball in objs
UpdateObject(ball)
DrawObject(ball)
next
' Remove out-of-bounds balls to prevent unnecessary collision checks
i = 0
while i < ballCount
if objs[i].x > 690 or objs[i].x < -50 or objs[i].y > 530
j = i
while j < ballCount - 1
objs[j] = objs[j + 1]
j = j + 1
wend
ballCount = ballCount - 1
else
i = i + 1
endif
wend

