Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: Keoni29 on June 02, 2011, 01:46:38 pm
-
I want to check if there is a solid tile. I'm using this code for tilemapping.
:[000000000000]→GDB1
:[000000000000]
:[000000000000]
:[000001200000]
:[000003400000]
:[000000000000]
:[000000000000]
:[000000000000]
:For(V,0,7)
:For(H,0,5)
:{V*6+H+GDB1}→A
:Pt-On(H*16,V*8,A/16*8+Pic1)
:Pt-On(H*16+8,V*8,A^16*8+Pic1)
:End
:End
:DispGraph
I ripped it from a french tutorial. I don't know if they mentioned this subject.
-
I figured this out:
{Y*6+X*GBD1}/16
{Y*6+X*GBD1}^16
These two give you the id of 2 tiles
When the x is even I have to check if{Y*6+X*GBD1}/16
When the x is not even I have to check if{Y*6+X*GBD1}^16
How do I check whether X/4 is an even number?
if X/4=????even???
{Y/8+1*6+(X/8)+GBD1}^16->BL
{Y/8+1*6+(X+7/8)+GBD1}/16->BR
{Y-1/8*6+(X/8)+GBD1}^16->TL
{Y-1/8*6+(X+7/8)+GBD1}/16->TR
{Y/8*6+(X-1/8)+GBD1}^16->LT
{Y/8*6+(X/8)+1+GBD1}^16->RT
{Y+7/8*6+(X-1/8)+GBD1}^16->LB
{Y+7/8*6+(X/8)+1+GBD1}^16->RB
Else
{Y/8+1*6+(X/8)+GBD1}/16->BL
{Y/8+1*6+(X+7/8)+GBD1}^16->BR
{Y-1/8*6+(X/8)+GBD1}/16->TL
{Y-1/8*6+(X+7/8)+GBD1}^16->TR
{Y/8*6+(X-1/8)+GBD1}/16->LT
{Y/8*6+(X/8)+1+GBD1}/16->RT
{Y+7/8*6+(X-1/8)+GBD1}/16->LB
{Y+7/8*6+(X/8)+1+GBD1}/16->RB
End
Is there an optimized way of doing this?
-
That's the function I'm using in my current Axe Parser project:
Text(1,,sub(CL,X,Y)>DEC
Lbl CL
{ + 4 / 8 * (Tilemap width) + ( r1 + 4 / 8 ) + (Tilemap Pointer) }
Return
It returns the tile ID of the tile at the middle point of an 8x8 object.
A bounding box can be constructed with sub(CL,X+4,Y+4) + sub(CL,X-4,Y+4) + sub(CL,X-4,Y-4) + sub(CL,X+4,Y-4)
-
Well, if you simply want to check if something is an even number:
If X/4^2 = 0
.It's zero
End