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

0 Members and 1 Guest are viewing this topic.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
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]
:[000000000000]→GDB1
:[000000000000]
:[000000000000]
:[000001200000]
:[000003400000]
:[000000000000]
:[000000000000]
:[000000000000]
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.
If you like my work: why not give me an internet?








Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
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->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?
« Last Edit: June 03, 2011, 05:24:45 am by Keoni29 »
If you like my work: why not give me an internet?








Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
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)

Ashbad

  • Guest
Re: Check if there is a solid tile
« Reply #3 on: June 03, 2011, 06:37:30 am »
Well, if you simply want to check if something is an even number:

Code: [Select]
If X/4^2 = 0
  .It's zero
End