Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Scipi on July 20, 2011, 10:20:41 am

Title: Need help with a bug
Post by: Scipi on July 20, 2011, 10:20:41 am
I've been learning Axe yesterday while I was on a car trip and I decided to practice by making a small sprite editor. It works fine except that it won't draw and it's reading incorrectly. I think the problem is with the list I use but I'm not sure.

Code: [Select]
.SPRITE

[FF818181818181FF0000000000000000]->Pic1
[3C7EFFFFFFFF7EC30000000000000000]->Pic2
DiagnosticOff
0->{L4}
Fill(L4, 63)
0->X->Y
Repeat geyKey(15)
For(A, 0, 7)
For(B, 0, 7)
{L4+A*8+B}
If Ans
Rect(A*8, B*8, 8, 8)
End
End
End
{L4+X+Y*8}
If Ans
Pt-On(X, Y, Pic2)
Else
Pt-On(X, Y, Pic1)
End
If getKey(2)
If X!=0
X-8->X
End
End
If getKey(3)
If X!=56
X+8->X
End
End
If getKey(4)
If Y!=0
Y-8->Y
End
End
If getKey(1)
If Y!=56
Y+8->Y
End
End
If getKey(54)
{L4+X+Y*8}
If Ans
0->{L4+X+Y*8}
Else
1->{L4+X+Y*8}
End
End
DispGraphClrDraw
End

You guys can probably find >9000 optimizations but what is happening is that, it displays the cursor fine. The cursor works. But when you press 2nd nothing happens. And it doesn't read correctly overall. Also, do I need to use r for {L4+X+Y*8}? As in {L4+X+Y*8}r

Thanks :D

Btw, Axe really is great!  ;D
Title: Re: Need help with a bug
Post by: yunhua98 on July 20, 2011, 10:26:45 am
I think Fill needs to be Zeroes, and are you actually putting a pixel for every 1 in L4?
Title: Re: Need help with a bug
Post by: Scipi on July 20, 2011, 10:40:07 am
yes, eventually I'll make an equation that parses through it, and makes the Hex for the sprite and save it to Str1 (course there's probably a MUCH better way to do it that I don't know about :P). But I want it to actually draw first. D:
Title: Re: Need help with a bug
Post by: Ashbad on July 20, 2011, 12:04:45 pm
Well, a few problems.  You must remember that Axe doesn't follow the standard order of operations in mathematica.  So, you're accessing the place of {(L4+x+y)*8}, not {y*8+x+L4} because axe uses left to Right operation order.

Also, why the use of Ans?  Ans in Axe is pretty much useless.  HL is what you use instead of Ans, but it can't be accessed directly.  So put If expression instead of expression:If Ans.
Title: Re: Need help with a bug
Post by: Scipi on July 20, 2011, 08:27:05 pm
Thanks, I will update that now. I didn't know about the left to right operations or the Ans.