I'm making a CSE tower defense game, and it runs kinda slow. I was wondering if anyone had any ideas on how to speed it up:
Code:
And here is the prgmAASHOOT
Code:
Code:
:CLASSIC Answer
:SetUpEditor {L1},{L2},{L3}
:DelVar {L1}DelVar {L2}DelVar {L3}
:Lbl MP
:ClrHome
:[[2,2,2,3,1,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1][2,1,1,3,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2][2,1,1,3,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2][2,1,1,3,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2][2,1,1,3,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,1,1,2][2,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,2][2,1,1,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,3,1,1,2][2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,2][2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,2][2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,1,3,2,2,2]]→[A]
:" O!-*1234 *→Str1
:For(A,1,10
:For(B,1,26
:Output(A,B,sub(Str1,[A](A,B),1
:End:End
:SetUpEditor {L1},{L2}
:2→A
:2→B
:DelVar K
:5→dim({L1}
:1→{L1}(1
:100→{L1}(2
:1→E
:{-}15→R
:
:
:
:Lbl T2
:While K≠102
:Output(A,B,"X
:{L1}(2)→θ
:If θ≥0 and θ<10
:26→Z
:If θ≥10 and θ<100
:25→Z
:If θ≥100 and θ<1000
:24→Z
:If θ≥1000
:23→Z
:If θ<0 and θ>{-}10
:25→Z
:If θ≤{-}10 and θ>{-}100
:24→Z
:If θ≤{-}100 and θ>{-}1000
:23→Z
:If θ≤{-}1000
:22→Z
:
:Output(1,Z,θ
:Repeat K
:getKey→K
:End
:If K=34 or K=24 or K=25 or K=26
:Output(A,B,sub(Str1,[A](A,B),1
:
:A+(K=34 and A≠9)-(K=25 and A≠2→A
:B+(K=26 and B≠25)-(K=24 and B≠2→B
:If [A](A,B)=1 and (K=92 or K=93 or K=94 or K=82 or K=15
:Then
:If K=15:Then
:Repeat K:getKey→K:End
:If K=33:Then
:Repeat K:getKey→K:End
:If K=44:Then
:Repeat K:getKey→K:End
:If K=55 and θ≥100:Then
:55→[A](A,B:θ-100→θ:End
:DelVar KEnd:End:End:End
:If K=92 and θ≥10:Then
:6→[A](A,B:θ-10→θ:End
:If K=93 and θ≥20:Then
:7→[A](A,B:θ-20→θ:End
:If K=94 and θ≥30:Then
:8→[A](A,B:θ-30→θ:End
:If K=82 and θ≥40:Then
:9→[A](A,B:θ-40→θ:End
:θ→{L1}(2
:Output(1,22,"
:End
:End
:Output(A,B,sub(Str1,[A](A,B),1
:
:Lbl L
:E+1→E
:R+15→R
:5E→dim({L2}
:E→dim({L3}
:For(C,1,E
:40+R→{L3}(C
:End
:
:For(C,1,E
:2-C→{L2}(5C-4)
:1→{L2}(5C-1
:5→{L2}(5C
:End
:Lbl LV
:For(D,1,26+E
:
:For(C,1,E
:If [A]({L2}(5C-1),{L2}(5C))≠1:Then
:1→[A]({L2}(5C-1),{L2}(5C
:{L1}(2)-100→{L1}(2
:End
:If {L2}(5C-4)>0 and {L2}(5C-4)≤27 and {L3}(C)>0
:Then
:Output({L2}(5C-1),{L2}(5C),"0
:prgmAASHOOT
:End:End
:For(C,1,E
:If {L2}(5C-4)>0 and {L2}(5C-4)≤27
:Output({L2}(5C-1),{L2}(5C),"
:End
:
:For(C,1,E
:If ({L2}(5C-4)>0 and {L2}(5C-4)<6) or ({L2}(5C-4)>22 and {L2}(5C-4)<27
:Then
:{L2}(5C-1)+1→{L2}(5C-1
:1→{L2}(5C-3)
:0→{L2}(5C-2)
:End
:
:If {L2}(5C-4)≥6 and {L2}(5C-4)≤22
:Then
:{L2}(5C)+1→{L2}(5C
:0→{L2}(5C-3)
:1→{L2}(5C-2)
:End
:
:If {L2}(5C-4)=40
:100→{L2}(5C-4
:End
:
:For(C,1,E
:{L2}(5C-4)+1→{L2}(5C-4
:End
:End
:DelVar K
:
:For(C,1,E
:If {L3}(C)≤0
:{L1}(2)+5→{L1}(2
:End
:Goto T2
And here is the prgmAASHOOT
Code:
:If {L3}(C)>0
:Then
:For(G,{-}2,1
:If {L2}(5C-4)>2 and {L2}(5C-4)<26
:Then
:If [A]({L2}(5C-1)+G,{L2}(5C)+2)≥6
:{L3}(C)-([A]({L2}(5C-1)+G,{L2}(5C)+2)-5)→{L3}(C
:If [A]({L2}(5C-1)-G,{L2}(5C)-2)≥6 and [A]({L2}(5C-1)-G,{L2}(5C)-2)≤9
:{L3}(C)-([A]({L2}(5C-1)-G,{L2}(5C)-2)-5)→{L3}(C
:If [A]({L2}(5C-1)+2,{L2}(5C)-G)≥6 and [A]({L2}(5C-1)+2,{L2}(5C)-G)≤9
:{L3}(C)-([A]({L2}(5C-1)+2,{L2}(5C)-G)-5)→{L3}(C
:If [A]({L2}(5C-1)-2,{L2}(5C)+G)≥6 and [A]({L2}(5C-1)-2,{L2}(5C)+G)≤9
:{L3}(C)-([A]({L2}(5C-1)-2,{L2}(5C)+G)-5)→{L3}(C
:End:End:Return