Re: A83: Tile maps


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

Re: A83: Tile maps




ok, i'll show you how i did it in asm(well i sort of did it....)
this is for the ti83 but it should be easy to change if you have to:

    ld hl,map           ;this loads the map data, format: width,height, 
mapdata
    ld (widht),hl           ;save map width
    inc hl              ;go to map height
    ld (height),hl      ;save map height
    inc hl              ;go to map data
    ld maploc,hl            ;save this pointer to maploc:

then in the tile grabbing function i can explain what to do, but i'm not 
getting it to work yet

    get the x and y
    set hl to maploc(set above)
    inc to x position
    loop begining
    inc by width
    dec y
    go to loop begining
    save tile value in hl to a value

now to draw the tile!
    ld hl,sprites
    begin loop
    if tilenum > 0
    inc hl 8 times
    decrease tilenum
    go back to loop
    now go x * 8 and y * 8
    and now call a drawing routine(after setting all values for it(hl 
contains the sprite         now)
    return!

now was that so hard? ^_^
hope that helped...sorry for the lack of code but i hope that helps you more 
then someone elses code would!