IGNORED

# 2 sprites on the same line

## Recommended Posts

Hi,

I perfectly understand Y positioning, and after following explanations (docs and samples provided here and newbies pdfs) I see how X positionning can be done for one sprite.

But I haven't found any doc on 2 sprites when they are on the same Y : as there is a loop for positionning in X it has to be cut in two, depending on which P1 or P0 has the lower X (I guesss)

but what if they are close ?

I only found for one sprite (which seems a 'simple' case)

Cheers,

Pe

##### Share on other sites

You might have to clarify whether you're talking about two different sprites (like P0 and P1) or if you're referring to doubles/triples of the same sprite or the a single sprite using alternate frames/flicker to imitate being two different sprites.

##### Share on other sites

6 hours ago, LatchKeyKid said:

You might have to clarify whether you're talking about two different sprites (like P0 and P1) or if you're referring to doubles/triples of the same sprite or the a single sprite using alternate frames/flicker to imitate being two different sprites.

Yep, right,

I mean P0 and P1 on the same line for instance. I may ask myself too much question but :

I first need to order x0 and x1: put the smallest value in A, in highest in B.

loop from 0 to A, trigger drawing PA, then loop from A (minus the number of cycles spent in drawing A or not drawing A) to B, then trigger PB

wondering if I'm doing to much work, of this is the way to go ?

Cheers

##### Share on other sites

15 hours ago, pec said:

But I haven't found any doc on 2 sprites when they are on the same Y : as there is a loop for positionning in X it has to be cut in two, depending on which P1 or P0 has the lower X (I guesss)

but what if they are close ?

The standard method is to position one sprite at a time, since the standard horizontal positioning routines require a scanline to position one sprite.  It would be difficult to make a general horizontal positioning routine that could handle setting more than one object position within a scanline.  It's not impossible to do but a bit difficult.  It would have constraints and require handling a few different situations.

Generally, if you're reusing the player sprites on a single screen (for example, sprites at top, reused at bottom), you would do positioning at the top and then somewhere on the scanlines between the sprite groups, and flicker within the groups if needed (i.e. if more than 2, and unable to use duplicate/triplicate mode).

For situations in which you only use the 5 TIA objects as they are (and not try to reuse them more than once on the screen), all positioning could be done off screen with the standard method... which would take at least 5 scanlines to accomplish.

##### Share on other sites

Posted (edited)
1 hour ago, splendidnut said:

For situations in which you only use the 5 TIA objects

Thanks a lot for your answer, I see .. but that means that these limitations have visual impacts: sprites can't have full horizontal resolution.

Arrh.. Thanks a lot for clarification, long road in front of me then !

Edited by pec
error
##### Share on other sites

All depends on what you're trying to accomplish.  Positioning two sprites (using P0 and P1 TIA objects) anywhere horizontally at the same Y coordinate is possible... just requires two scanlines to be used to do the horizontal positioning before the scanlines at which they are drawn.

##### Share on other sites

Posted (edited)

@pec  What you (may) be missing is that when you set the X position of P0 or P1 or whatever, it STAYS set until you change it again.  So many games set the X at the top of screen or whatever and the sprites are only drawn when needed at their proper Y

coordinates.

It's perfectly OK, for example to set an X position and not even draw the sprite.  Two independent things.

Edited by glurk
mistake
##### Share on other sites

Posted (edited)
18 hours ago, glurk said:

@pec  What you (may) be missing is that when you set the X position of P0 or P1 or whatever, it STAYS set until you change it again.  So many games set the X at the top of screen or whatever and the sprites are only drawn when needed at their proper Y

coordinates.

It's perfectly OK, for example to set an X position and not even draw the sprite.  Two independent things.

whoooo ... you are right !

I can write to Resp0 and resp1 while being in overscan, reserving 2 lines for that, so i can then position them anywhere, even on top of each others and without doubling the height.

and only put values different from 0 into GRPO and GRP1 when  Y gets to the Y of each sprites

Oh ! So much simpler.. Thx a lot !

Edited by pec
##### Share on other sites

You might like to check out my tutorial which covers writing a 2K game from start to finish. The game uses both players, both missiles, the ball, and playfield.

##### Share on other sites

I'm pretty sure that I've mentioned it before but just in case I'll say it here... I really love the dragon sprite!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.