Re: LZ: Mapping Question


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

Re: LZ: Mapping Question




 Here's a pretty simple way of doing what I think you want to do:
 i) use a sprite table. If you're got sprites say, called spriteA,
spriteB, spriteC and spriteE, and in your program, you'd put something
like this:
SpriteTable:
.dw spriteA, spriteB, spriteC, spriteE ; etc
now spriteA corresponds to what would be a 0 on the map, spriteB=1, etc
Your map should just be a bunch of numbers corresponding to which sprite
to draw.

to fetch a sprite, do something like this:
ld a, (hl) ; where hl points to the location on the map you want to read
ld d, 0
ld e, a
ld hl, spriteTable
CALL LD_HL_MHL
add hl, de
ld de, (PROGRAM_ADDR)
add hl, de ; there's the sprite

I'm not totally sure this works, but I think it should.

					Erik Huizing
					ehuizing@acs.ucalgary.ca
					http://www.ucalgary.ca/~ehuizing


On Wed, 28 May 1997, Jim Reardon wrote:


Okay, I have a routine that will stepwise draw 8x8 sprites along the
screen, now my question is how I would make this routine read data from a
map, and baised on that decide what sprite to draw.

Would I have to use a bunch of cp's to determine it or is it possible to
use a lookup table with the memory addresses of the sprites baised on the
number they are assigned?

Basically I want to be able to make a map sorta like how Slippy's is laid
out.

Help is greatly appreciated.

ALSO: is there any way to still join LZA?

Jim Reardon
jim.reardon@juno.com
Viva La Mexico
http://pages.prodigy.net/eviljim/
We all come into the world the same way - naked, screaming, covered in
blood.  But if you live your life right, that kind of thing doesn't have
to end there.


Follow-Ups: References: