Re: LZ: programming q's


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

Re: LZ: programming q's



Will Stokes (3D Diamond productions / Global Games) wrote:
> 
> I'm really coming along on my racing game. The sprite for the car should
> be simple enough. I have three simple questions that many should be able
> to answer. Any suggestions and help would be great!!
> 
> (a.) matrices. I want to built a 1 by 127 matrix. Ok, say I start out
> witht eh first value say, 54, then put it into the martrix. Then i figure
> out the second and so on values for the following secions in the matrix.
> All values will be less then 63 so 127 bytes will be good right? Anyway,
> to be a little mroe general, how do I do this? That is, set aside space
> for this matrix (w hich is really a vector), put values into it, shift is
> right or left, and take values out of it for manipulation and basic usage?

If you have a big vector (or matric) you may have to store it inside your program.
In your case, 127 byte isn't that much and the vector could be stored in
TEXT_MEM2 ($8A6B) for example. The first element is number 0 (always when using
matrices). Decrease with one if you want 1 - 127. Use these routines for example.
You may want to change the input and output registers.

StoreByte:  ; Stores A in vector at $8A6B at position E (1-127)
 dec e
 ld d,0
 ld hl,$8A6B
 add hl,de
 ld (hl),a
 ret

LoadByte:   ; Loads A with the byte in vector at $8A6B from position E (1-127)
 dec e
 ld d,0
 ld hl,$8A6B
 add hl,de
 ld a,(hl)
 ret

> (b.) i've been trying to randomly trying to get either 0 or 1 by
> 
> ld a, r
> and 1
> 
> but weird stuff happens when i put it all together. If anybody would like
> to know more about that and how I can fix it it would be great.

The R register is added with 2 after each instruction, so you should

ld a,r
srl a
and 1

> (c.) for sprites, what are the x and y coordinates for the lower left
> corner (or whatever corner is used)? That is do I put coordinates in b
> and c for NASR WARP? I'm kinda confused.

If you use NASR, the y axis is backwards since it uses FIND_PIXEL without
modifying the y coord. That's stupid :-) And, if the sprites are <=8 in
width you should use my PutSprite routine (at my ZShell School lesson #5) which
is much smaller and much faster.

> 
> Anyway, all the help so far has allowed me to built a pretty decent start
> at what looks like a pretty cool game. Any help is much appreciated.
>                         Will Stokes

-- 
Jimmy Mårdell               "Breaking your trust in sorrow, until you face
mailto:mja@algonet.se        the dreams of tomorrow, has taken place
http://www.algonet.se/~mja   Your life has been turning, inside your head
IRC: Yarin                   The truth will be burning, until your dead"


References: