Re: A82: Zpong


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

Re: A82: Zpong



No, the sprite routine I wrote for galaga, works the same way, except that it
does an entire sprite and is easier to use, however I need to know the answers
to the questions I asked
n a message dated 97-10-21 10:36:11 EDT, you write:

> Here are two routines:
>  
>  Several notes:
>  1) I had some problems with this, never fixed them (Basically, when you 
> called
>  drawpaddle or clearpaddle, the ball bounces back at about 80 instead of 95.
> Dunno
>  why), I just used Point_on instead. BTW: Point_On can draw a border around 
> the
>  entire screen faster than the human eye can see. Shouldn't have any speed
>  problems with it. I'm now using it in my pong game, and it works fine. It 
> makes
>  it a bit easier, since I was already using it for the ball. I would have
had 
> to
>  convert between the two coordinates to figure if the ball had hit the
paddle 
> or
>  not.
>  2) To use them, put the y position of the top of the paddle into a. Put the
> x
>  position into b, and for DrawPaddle only, put the paddle into c. (Ex: %
> 10000000
>  for the left or %00000001 for the right)
>  
>  ClearPaddle:   ; This will clear the 8x8 square with the upper-right corner
> at b,
>  a
>   out ($10), a  ; a is already loaded with the Y value, and since we have
not
>  written to the display controller in a while, no delay is needed. Tell the
>  display controller the Y coordinate
>  
>   ld a, b   ; Get the X coordinate from b into a
>   call $7F3   ; Delay for the display controller
>   out ($10), a  ; Tell the display controller the X coordinate
>  
>   ld b, Paddle  ; The paddle is as tall as the number in paddle, so we
repeat 
> the
>  loop 8 times. This is so it is easy to change the length. Just change the 
> number
>  what paddle is
>   ld a, %00000000  ; We are drawing a zero byte, to erase the paddle
>  ClrLoop:
>   call $7F3   ; Delay for the display controller
>   out ($11), a  ; Write a byte to the display controller
>   djnz ClrLoop  ; Repeat until we have written 8
>   ret    ; Return to where we left off
>  
>  DrawPaddle:    ; This will will write an 8x8 square with the right side 
> black and
>  an upper-right corner at b, a
>   out ($10), a  ; a is already loaded with the Y value, and since we have
not
>  written to the display controller in a while, no delay is needed. Tell the
>  display controller the Y coordinate
>  
>   ld a, b   ; Get the X coordinate from b into a
>   call $7F3   ; Delay for the display controller
>   out ($10), a  ; Tell the display controller the X coordinate
>  
>   ld b, Paddle  ; The paddle is as tall as the number in paddle, so we
repeat 
> the
>  loop 8 times
>   ld a, c  ; Put either %10000000 or %00000001 into c, depending on which 
> side
>  we're on
>  PrnLoop:
>   call $7F3   ; Delay for the display controller
>   out ($11), a  ; Write a byte to the display controller
>   djnz PrnLoop  ; Repeat until we have written 8
>   ret    ; Return to where we left off