[A83] Re: Tilemap


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

[A83] Re: Tilemap



Well...... I am changing it simply from 13x9  to 14x10. You're directions 
were clear, but It's not working for me.

Before I changed to larger map:
---------------------------------------------
left:
;all the shift routines use the same style, so it's only commented once:
;since we have a 13x9 tilemap, we can only shift right,left,up,down once,
;so check if we aren't already. If we are already u,l,d,r, return to the 
loop..
  ld a,(x_origin)
  cp 1
  jr nz,wait

;else, decrement the x origin for left, increment it for right..
;decrement the y origin for up, increment it for down...
;origin is already in a since we needed to check it...
  dec a
  ld (x_origin),a
;call the tilemap routine...
  call writemap
;and write the buffer to the screen:
  bcall(_grbufcpy)
  jr wait

right:
  ld a,(x_origin)
  cp 0
  jr nz,wait
  inc a
  ld (x_origin),a
  call writemap
  bcall(_grbufcpy)
  jr wait

up:
  ld a,(y_origin)
  cp 1
  jr nz,wait
  dec a
  ld (y_origin),a
  call writemap
  bcall(_grbufcpy)
  jr wait

down:
  ld a,(y_origin)
  cp 0
  jr nz,wait
  inc a
  ld (y_origin),a
  call writemap
  bcall(_grbufcpy)
  jr wait

; Then there was the
map_width:
  .dw 13 ; width of map as a word!

After I changed to larger map:
---------------------------------------------
left:
;all the shift routines use the same style, so it's only commented once:
;since we have a 13x9 tilemap, we can only shift right,left,up,down once,
;so check if we aren't already. If we are already u,l,d,r, return to the 
loop..
  ld a,(x_origin)
  cp 1
  jr nz,wait

;else, decrement the x origin for left, increment it for right..
;decrement the y origin for up, increment it for down...
;origin is already in a since we needed to check it...
  dec a
  ld (x_origin),a
;call the tilemap routine...
  call writemap
;and write the buffer to the screen:
  bcall(_grbufcpy)
  jr wait

right:
  ld a,(x_origin)
  cp 2
  jr nz,wait
  inc a
  ld (x_origin),a
  call writemap
  bcall(_grbufcpy)
  jp wait

up:
  ld a,(y_origin)
  cp 1
  jr nz,wait
  dec a
  ld (y_origin),a
  call writemap
  bcall(_grbufcpy)
  jp wait

down:
  ld a,(y_origin)
  cp 2
  jr nz,wait
  inc a
  ld (y_origin),a
  call writemap
  bcall(_grbufcpy)
  jp wait

; then there was the
map_width:
  .dw 14 ; width of map as a word!
I suppose you're modifying my example program,
> then I suppose too that you're forgetting to modify the left/right/up/down 
> routines...
> the Down and right routines compare to 13 (original width) - 12 (=1)
> and 9 (original height) - 8 (=1)
> 
> you need to change the value in the down routine to [your height] - 8
> and in the right routine to [your width] - 12
> 
> hope this helps...
> --Peter-Martijn
> 







Follow-Ups: