[A83] Re: Tilemap
[Prev][Next][Index][Thread]
[A83] Re: Tilemap
> OK......... How do I enlarge the size of the tilemap?
Simple... add extra bytes to the rows, and add rows.
Don't forget to set the map_width: value to the right row length.
(if the db statements get too large, try this:
.db x,x,x,x,x,x,x,x,x,x,x,x,x,x \ .db x,x,x,x,x,x,x,x,x
where x is ofcourse a tilemap number)
> And check for sprite
> and tile collision? Like if sprite touches tile 2, then something happens?
That requires a totally different approach...
You might want to try something like this:
cmap_width:
.dw 12
collissionmap: ;0 is walkable, 1 is collission
.db 0,0,0,0,0,0,0,0,0,0,0,0
.db 0,0,0,0,0,0,0,1,0,0,1,0
..etc..
collission_check:
;inputs: e = x co-ordinate, d = y co-ordinate of sprite. (in tiles)
; pixel checking requires to check the TopL,TopR,BotL and BotR bits of the
; sprite for being in a "wrong" part of the map, and I don't have time to
; work that out now...
ld hl,collissionmap
ld a,d
ld b,d
cp 0
jr z, no_y
push de
y_loop:
ld de,(cmap_width)
add hl,de
djnz y_loop
pop de
ld d,0
add hl,de
ld a,(hl)
cp 1
ret
; nz flag set is walkable, z flag set means forbidden
Hope it helps, it's not tested and probably not very efficient (i wrote it on the fly), but it should be usable for checking when your sprite can only be on one tile at a time... (which is probably not what you want ;)
Oh, and, when replying, quote at least parts of the email you're replying to!
--Peter-MArtijn Kuipers
> Thanks,
> darkfire139@aol.com
>
>
>
Follow-Ups:
References: