Your issue arises from this block of code:
1 2 3 4 5 6
If C For(L,0,C) .Snip End End
I see two issues with this. First, because of how you add bullets, the first bullet is located at
L1 +2 , whereas this loop structure treats
L1 as the location of the first bullet. Secondly, this loop will run 0 times if C equals 0, but it will run C+1 times if C doesn't equal 0. For instance, if C equals 1, the loop will iterate for L equals 0 and 1, for two iterations total. This extra iteration in combination with reading data at
L1 that's not a bullet is what's causing the issues you're seeing.
Thankfully, the fix for this is really easy. It even allows you to completely remove the
If C block surrounding the for loop! Just change the lower bound of the for loop to 1.
Alternatively, the most optimized way to fix this is with your own loop structure.
1 2 3 4 5 6 7
C While →L .Snip L-1 End
And just for fun, here's my optimized version of the entire program. It's also attached.
Spoiler for Hidden :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
.BULLET 0→C→D 15→X→Y [18247EBDFFBDFFA5]→Pic1 [183C3C3C3C240000]→Pic2 While 1 Pt-On(getKey(3)-getKey(2)+X→X,getKey(1)-getKey(4)+Y→Y,Pic1) !If D If getKey(54) X→{Y→{C++*2-2+L1}+1} 4 End +1 End -1→D C While -1→L {*2+L1→P}-- Pt-On({}ʳʳ,/256,Pic2) !If -L6 Copy(C--*2+L,P,2) End L End DispGraphClrDraw EndIf getKey(15)
If the code box is tiny, that's because Chrome fails. Click "Select All" and then press Ctrl+C to copy it, then just paste it into something like notepad to view it.