### Author Topic: Check if there is a solid tile  (Read 2318 times)

0 Members and 1 Guest are viewing this topic.

#### Keoni29

• LV11 Super Veteran (Next: 3000)
•           • • Posts: 2466
• Rating: +291/-16 ##### Check if there is a solid tile
« 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.
Code: [Select]
:→GDB1:::::::
Code: [Select]
: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.

#### Keoni29

• LV11 Super Veteran (Next: 3000)
•           • • Posts: 2466
• Rating: +291/-16 ##### Re: Check if there is a solid tile
« Reply #1 on: June 03, 2011, 04:55:22 am »
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?
Code: [Select]
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->RBElse{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->RBEnd
Is there an optimized way of doing this?

#### Aichi

•     • • Posts: 290
• Rating: +76/-3 ##### Re: Check if there is a solid tile
« Reply #2 on: June 03, 2011, 05:53:21 am »
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) If X/4^2 = 0  .It's zeroEnd