Re: A86: bomberman mapping


[Prev][Next][Index][Thread]

Re: A86: bomberman mapping



In a message dated 97-09-23 16:25:05 EDT, you write:

> 
>  I would discourage this approach because of its size.  The code I would 
>  use is this:
>  
>  ;de points to the level you want to load.
>  LoadLevel:
>       ld   hl, LevelBuffer
>       ld   c, 16        ;16 bytes
>  NewByte:
>       ld   b, 4
>       ld   a, (de)
>       inc  de
>  InnerLoop:
>       ld   (hl), 0
>       RLA
>       RL   (hl)
>       RLA
>       RL   (hl)
>       inc  hl
>       DJNZ InnerLoop
>       dec  c
>       jr   NZ, NewByte
>       ret
>  Level1:
>  ..db  %01010101, %01010101
>  ..db  %01000001, %00010001
>  ..db  %01000111, %00010001
>  ..db  %01000101, %00010001
>  ..db  %01000000, %00000001
>  ..db  %01000001, $01000001
>  ..db  %01000001, %01000001
>  ..db  %01010101, %01010101
>  Level Buffer: <<64 bytes>>
>  
>  Steve86Asm@aol.com (Steve86Asm@aol.com) wrote:
>  >The 1st really woudn't be that hard.  You could use just the buffer,
rather
>  >than the map whenever you reference it.
>  >
>  >For example, if each map is 8x8 and you have 1 byte per square (not too
>  >familiar with bomberman, but aren't there more than just 1 type of
block?),
>  >maybe something like this:
>  >Level1:
>  > .db 1,1,1,1,1,1,1,1
>  > .db 1,0,0,1,0,1,0,1
>  > .db 1,0,1,2,0,1,0,1
>  > .db 1,0,1,1,0,1,0,1
>  > .db 1,0,0,0,0,0,0,1
>  > .db 1,0,0,1,1,0,0,1
>  > .db 1,0,0,1,1,0,0,1
>  > .db 1,1,1,1,1,1,1,1
>  >LevelBuffer:
>  > .db 0,0,0,0,0,0,0,0
>  >  ;(7 more times)
>  >
>  >then you could use this code to load the level:
>  >
>  > ld hl,Level1              ;source
>  > ld de,LevelBuffer      ;destination
>  > ld bc,64                  ;# bytes
>  > ldir
>  >
>  >and then use LevelBuffer when you reference the level.
>  
>  
>  James Yopp

Which part of this method is too large.  The reason I used bytes was because
I wasn't sure if the game needed more than 2 states (I think it does, because
it needs an exit door, enemies, etc.).  If you think that the buffer would be
too large no matter how you fill it, I don't think that 64 bytes even is too
much for that.

~Stephen Hicks


Follow-Ups: