I've been working on this stat sprite version of Pong for the past week and I've reached the point where I can't speed it up any further. I've done all the optimizations that I can do. I was wondering if the speed issue is to be expected from using stat sprites, or if I'm missing some optimization. Here is the code:
BASIC Code wrote:
:ClrHome
:ClrDraw
:0→Xmin
:0→Ymin
:94→Xmax
:62→YMax
:AxesOff
:GridOff
:CoordOff
:LabelOff
:ExprOff
:PlotsOff
:FnOff
:1,2,0,1,2,3,0,1,2,3,1,2→L1
:0,0,1,1,1,1,2,2,2,2,3,3→L2
:0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7→L3
:L3→L5
:0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1→L4
:L4→L6
:DelVar K4→A
:4→B
:L2+2→L2
:L6+60→L6
:L1+4(iPart(randInt(0,86)/4→L1
:L3+8(iPart(randInt(0,86)/8→L3
:L5+8(iPart(randInt(0,86)/8→L5
:Repeat (K=45) xor (((L2(1)=2) and (L1(3)<L3(1) or L1(3)>(L3(1)+8)) or ((L2(1)=58) and (L1(3)<L5(1) or L1(3)>(L5(1)+8))))
:L1+A→L1
:L2+B→L2
:Plot1Scatter ,L1,L2,∙
:Plot2Scatter ,L3,L4,∙
:Plot3Scatter ,L5,L6,∙
:Pt-Off(‾1,0
:A-8((L1(3)≥90)-(L1(3)≤2→A
:B-8((L2(1)≥58)-(L2(1)≤2→B
:L5-8((L5(1)≥(L1(3)-4))(L5(1)≥8)-(L5(1)≤(L1(3)+4))(L5(1)≤80→L5
:getKey→K
:L3-8((K=24)(L3(1)≥8)-(K=26)(L3(1)≤80→L3
:End
:Pause
:PlotsOff
:DelVar ADelVar BDelVar KDelVar L1DelVar L2DelVar L3DelVar L4DelVar L5DelVar L6Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech
:ClrDraw
:0→Xmin
:0→Ymin
:94→Xmax
:62→YMax
:AxesOff
:GridOff
:CoordOff
:LabelOff
:ExprOff
:PlotsOff
:FnOff
:1,2,0,1,2,3,0,1,2,3,1,2→L1
:0,0,1,1,1,1,2,2,2,2,3,3→L2
:0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7→L3
:L3→L5
:0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1→L4
:L4→L6
:DelVar K4→A
:4→B
:L2+2→L2
:L6+60→L6
:L1+4(iPart(randInt(0,86)/4→L1
:L3+8(iPart(randInt(0,86)/8→L3
:L5+8(iPart(randInt(0,86)/8→L5
:Repeat (K=45) xor (((L2(1)=2) and (L1(3)<L3(1) or L1(3)>(L3(1)+8)) or ((L2(1)=58) and (L1(3)<L5(1) or L1(3)>(L5(1)+8))))
:L1+A→L1
:L2+B→L2
:Plot1Scatter ,L1,L2,∙
:Plot2Scatter ,L3,L4,∙
:Plot3Scatter ,L5,L6,∙
:Pt-Off(‾1,0
:A-8((L1(3)≥90)-(L1(3)≤2→A
:B-8((L2(1)≥58)-(L2(1)≤2→B
:L5-8((L5(1)≥(L1(3)-4))(L5(1)≥8)-(L5(1)≤(L1(3)+4))(L5(1)≤80→L5
:getKey→K
:L3-8((K=24)(L3(1)≥8)-(K=26)(L3(1)≤80→L3
:End
:Pause
:PlotsOff
:DelVar ADelVar BDelVar KDelVar L1DelVar L2DelVar L3DelVar L4DelVar L5DelVar L6Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech