Re: Multplexing sprites



"Stu Carter" <stu@xxxxxxxxxxxxxxxxxxx> wrote in message
news:Pine.LNX.4.60.0510061446370.24483@xxxxxxxxxxxxxxxxxxxxxxx
> 1) When can I move a sprite that's in use? Do I have to wait until the
> line after its last 'active' line?

If you change the Y-coord after the sprite has started drawing, the entire
sprite will finish drawing where it is, then restart at the new Y-coord. If
the new position is immediately below the old one, they can match up without
blank lines inbetween. If the new start position is inside where the old
one was drawing, it won't redraw, because sprites are only in a "drawing" or
"not drawing mode", triggered on the first line of the sprite matching the
Y-coord.

Changing X-coords, color, frame, etc, should take effect the same or next
line, and can be used to "split" sprites in many different ways.

> I've found some guides on the net but nothing that clearly sets out the
> rules in one place. I guess - implied by super hi-res mode, or whatever
> it's called - that a sprite can be reused directly below itself as long as
> your timing is accurate.

Yes. The easiest is to just change the y coordinate and nothing else. You
can do this change anytime while the previous sprite is drawing. The
problematic timing is getting the color and frame to happen exactly between
those 2 raster lines of display. You can play tricks with having
tops/bottoms of adjacent sprites be similar, not using changing colors in
those few lines of the sprites, etc, to get around timing requirements, of
course at the expense of some graphical flexibility.

> Incidentally, I'm looping in the following manner... is this stupid or
> acceptable?
>
>
> lda #0
> sta var_i
> loop:
>
> ; CODE HERE
> lda #8
> sec
> inc var_i
> sbc var_i
> bne loop

If you're not using the value of var_i, and are just using it to count 8
iterations, it's always faster to count down instead of up, since checking
for zero comes free.

lda #8
sta var_i
loop:
;blahblah

dec var_i
bne loop


If you have .X or .Y free, you can use those, too:

ldx #8
sta var_i
loop;
;l33t c0de

dex
bne loop


If you do need to specifically count up, see Cameron's examples. Also, make
sure that var_i is in zero page (you should basically treat zero page as 256
pseudo-registers), because instructions are shorter and faster in zp.

--
White Flame (aka David Holz)
http://www.white-flame.com/
(spamblock in effect)


.



Relevant Pages

  • Re: I need advices to make a game with delphi 7.
    ... > around with the mouse (sprite: movable element of the picture, ... > message queue, instead a new message replaces the last one still in the ... If your drawing is too slow the movement will not be smooth since ... > to redraw on every point of the mouse trajectory. ...
    (borland.public.delphi.language.objectpascal)
  • Re: Multplexing sprites
    ... sprite will finish drawing where it is, then restart at the new Y-coord. ... If the new start position is inside where the old one was drawing, it won't redraw, because sprites are only in a "drawing" or "not drawing mode", triggered on the first line of the sprite matching the Y-coord. ...
    (comp.sys.cbm)
  • Re: Art proudness
    ... > Sprite wrote: ... >>>Considering I'm utterly rubbish at drawing, trying with a touchpad ...
    (uk.games.video.misc)
  • Re: ID3DXSprite not stretching correctly.
    ... I think you might need to look up the general form of a scaling matrix... ... sprite to actually be the center of the sprite (seems obvious, ... > The Width and Height of the texture from which I am drawing is 256×256. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Wimp_PlotIcon notes
    ... in this context when output is redirected to a sprite because the Wimp ... it's because BASIC is passing zero in some other ... I pinned it down to R2-R5. ...
    (comp.sys.acorn.programmer)

Loading