Re: A86: re: moving sprites


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

Re: A86: re: moving sprites



Mark Zimmerman wrote:
> 
> I didn't really know how to do a decent loop with this thing. I was using
> your routine and got the picture, but no movement. What I need is some type
> of loop to get the sprite to move about 30 spaces (x-coord=10 to
> x-cood=40). My y-coord is 24. The game, I'm not sure if I'll be releasing
> it or not, is a kind of Duckhunt clone. That's why I've been looking off
> the source to it as help.
> 
> start:
>         call    _clrLCD
>         call    _runindicoff
>         call    titledisp
>         call    no_key
>         call    BG
>         call    no_key
>         call    putspr
>         ret
> titledisp:                              ;----------------
>         .                               ;I got all of this working
>         .                               ;so I won't bother
>         .                               ;copying it since it
> no_key:                         ;really isn't that
>         .                               ;important.
>         .                               ;
>         .                               ;----------------


^> putspr:
|> 
|>         ld       hl,duckr               ;I know what this does
|>         ld       a,10                   ;but I don't know
|>         ld       e,24                   ;how to get it
V
heres the problem, move this little section of code up to the start,
because you are telling it to keep moving 10,24 to the place where the
pic will be put

          ld       a,b
          ld       e,c
>         ld       b,a                    ;to keep moving
>         ld       c,e                    ;the sprite around
>         push     bc
>         call     PutSprite
>         pop      bc
>         ld       a,b ;delete this
>         ld       e,c ;delete this
>         inc      a
          ld       b,a ;add that there
>         ret

and before the ret in the PutSprite routine, put a pop bc, because u
need to retrieve these values for the next loop


References: