:For(G,1,I)
:If pxl-Test({L2+(G*4)},{L2+(G*4)+1})
:For(θ,1,U)
:If {L2+(G*4)}=({L1+(θ*4)}) or ({L2+(G*4)}=({L1+(θ*4)}-1))
:If {L2+(G*4)+1}=({L1+(θ*4)+1}) or ({L2+(G*4)+1}=({L1+(θ*4)+1}-1))
:{L1+(θ*4)+2}-100→{L1+(θ*4)+2}
:0→r1
:If {L1+(θ*4)+2}=0 and (U≠0)
:S+10→S
:100→{L1+(θ*4)+2}
:Pxl-Off({L1+(θ*4)},{L1+(θ*4)+1})
:Pxl-Off({L1+(θ*4)},{L1+(θ*4)+1}-1)
:Pxl-Off({L1+(θ*4)}-1,{L1+(θ*4)+1})
:Pxl-Off({L1+(θ*4)}-1,{L1+(θ*4)+1}-1)
:5→{L1+(θ*4}→{L1+(θ*4)+1}
:r1+1→r1
:End:End
:End:End
:U-r1→U
:
:{L2+(I*4)}→{L2+(G*4)}
:{L2+(I*4)+1}→{L2+(G*4)+1}
:{L2+(I*4)+2)→{L2+(G*4)+2}
:0→{L2+(I*4)}→{L2+(I*4)+1}→{L2+(I*4)+2}
:I-1→I
:Else
:Pxl-On({L2+(G*4)},{L2+(G*4)+1})
:End:End
I have had a similar problem with a project of my own previously, and assuming the enemies freeze the moment another one gets killed, you might be doing something wrong in the code that removes enemies from the buffer when they get killed. An enemy "freezing" could have several causes: forgetting to erase an enemy from the screen buffer, or incorrectly/not moving backwards the remaining enemy entries in the buffer when one is removed (in my case it was the latter, causing enemies to turn invisible and randomly freeze and warp around when one was killed).It's 2nd to shoot (also included the more necessary info in first post)
Narrow down the randomness of a "sometimes-occuring" bug to specific criteria that must be met to reproduce the problem.
Lbl DIFF1
0→A→B→C→S→T→R→U→D→I→θ→G→{L1}→{L2}
0→{L1}
L1→{L2}
:If K=15
:Goto DIE:End
:If K=33
:0→L:Else:End
:If K=34
:1→L:Else:End
:If K=26
:2→L:Else:End
:If K=16
:3→L:Else:End
If K=47 and (Z=0):1→R:End
If {L1+(θ*4)}=(X+1) or ({L1+(θ*4)}=(X-2)) or ({L1+(θ*4)}=X) or ({L1+(θ*4)}=(X-1)) or ({L1+(θ*4)}=(X+2))
.
Lbl DIFF1
0→A→B→C→S→T→R→U→D→I→θ→G→{L1}→{L2}
:If K=15
:Goto DIE:End
:If K=33
:0→L:Else:End
:If K=34
:1→L:Else:End
:If K=26
:2→L:Else:End
:If K=16
:3→L:Else:End
If K=47 and (Z=0):1→R:End
Oh I see, should I use the Fill( command to zero out the ram?No, just do 0→{L2}
What is a LUT and what does inData do?LUT stands for Look-up-table. It is basically just a constant array with values. You can get each value by accessing the data with an index. That is usually a lot faster than having a calculation for it.
{0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225}→GBD1 ; a LUT with the squares of 0-15
...
instead of a calculation like
A²→B
you can use the LUT:
{A+GBD1}→B
inData(BYTE,PTR) Searches for BYTE in the zero-terminated data. If found, it returns the position it was found in (starting at 1). If not found, 0 is returned.
{33,34,26,16,0}→GBD1
at the point where we need the data, we use inData().If inData(K,GBD1)→F ; if the key is one of the weapon selectors
F-1→L ; take this value (1-4) and subtract 1 (then we have 0-3) and store it in L.
End
optimized to save a variable:If inData(K,GBD1)
-1→L ; that is the subtraction minus sign, same as above. It subtracts from the last evaluated expression, which is "inData"
End
I never knew about the "+" and "*" operationsI'm sure you know them "+" does add and "*" does multiply. :P
Code: [Select]Lbl DIFF1
0→A→B→C→S→T→R→U→D→I→θ→G→{L1}→{L2}
storing something into a Ram location pointed to and will return the address of that location, not the value.
You're basically doing that - which is not what you want:Code: [Select]0→{L1}
L1→{L2}
then, the elses here make absolutely no sense to me:Code: [Select]:If K=15
:Goto DIE:End
:If K=33
:0→L:Else:End
:If K=34
:1→L:Else:End
:If K=26
:2→L:Else:End
:If K=16
:3→L:Else:End
You could also use a LUT and the inData( Command.
Use + instead of "or" and * instead of "and" in when doing conditionals, those are bitwise operations.Code: [Select]If {L1+(θ*4)}=(X+1) or ({L1+(θ*4)}=(X-2)) or ({L1+(θ*4)}=X) or ({L1+(θ*4)}=(X-1)) or ({L1+(θ*4)}=(X+2))
What is a LUT and what does inData do?LUT stands for Look-up-table. It is basically just a constant array with values. You can get each value by accessing the data with an index. That is usually a lot faster than having a calculation for it.
Example:Code: [Select]{0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225}→GBD1 ; a LUT with the squares of 0-15
...
instead of a calculation like
A²→B
you can use the LUT:
{A+GBD1}→B
You can use an LUT also the other way round. Axe provides the function inData() for that.Quote from: Axe Command ListinData(BYTE,PTR) Searches for BYTE in the zero-terminated data. If found, it returns the position it was found in (starting at 1). If not found, 0 is returned.
Zero-terminated means, that the last value of the LUT has to be 0 respectively the first 0 in the LUT is considered as the end.
Say, at the beginning of the code we have a LUT with our keys, ending with 0:Code: [Select]{33,34,26,16,0}→GBD1
at the point where we need the data, we use inData().Code: [Select]If inData(K,GBD1)→F ; if the key is one of the weapon selectors
optimized to save a variable:
F-1→L ; take this value (1-4) and subtract 1 (then we have 0-3) and store it in L.
EndCode: [Select]If inData(K,GBD1)
-1→L ; that is the subtraction minus sign, same as above. It subtracts from the last evaluated expression, which is "inData"
End
Only applies if the pointer is not a constant! :P L2 is a constant, so that part of his code is fine.Whoa, didn't know that! :)
Remember, the syntax to create a list of data in Axe is different from that in TI-BASIC:Stupid mistake :banghead:
Data(0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225)→GBD1
Also would the arithmetic logic be a good optimization for speed on a ti84+SE?For "+" always, but for the multiplying I have to admit that runer's right. Take the bitwise "and" when you compare booleans.