Jump to content
IGNORED

Sprite info...


marc.hull

Recommended Posts

A sprite Y coordinate is "partially signed". Any Y value over >E0 (224) (i.e. >E1 to >FF, or 225 to 255 unsigned, or -31 (225) to -1(255)) is considered signed. This is to allow the sprites to "slide in" from the top of the screen. So, when the Y value goes over >E0, the sprite starts to appear at the top depending on how big the sprite is. If the sprite is 16x16 magnified, then at 225 you will see the bottom pixel row of the sprite (note that this is "1 pixel", and NOT "1 magnified pixel" which is really 2x2 pixels.)

 

Also note that the reason you have to use a Y of 255 to get a sprite on the top row is because the VDP processes sprites one line *before* where they are actually displayed. That's why a Y value of 0 is shown on row 1, etc.

Link to comment
Share on other sites

A sprite Y coordinate is "partially signed". Any Y value over >E0 (224) (i.e. >E1 to >FF, or 225 to 255 unsigned, or -31 (225) to -1(255)) is considered signed. This is to allow the sprites to "slide in" from the top of the screen. So, when the Y value goes over >E0, the sprite starts to appear at the top depending on how big the sprite is. If the sprite is 16x16 magnified, then at 225 you will see the bottom pixel row of the sprite (note that this is "1 pixel", and NOT "1 magnified pixel" which is really 2x2 pixels.)

 

Also note that the reason you have to use a Y of 255 to get a sprite on the top row is because the VDP processes sprites one line *before* where they are actually displayed. That's why a Y value of 0 is shown on row 1, etc.

 

Ok that's over my head could you dumb it down a shade ? For example if I write 254 to the Y location will that place the sprite 1 pixel above the screen while 253 would be 2 pixels above the screen ?

Link to comment
Share on other sites

I understand that the onscreen sprite rows start @>FF and then are ordered 0 to 190. Is it correct that when a sprite moves off the top of the screen it goes to location >FE then >FD etc until it appears at the bottom again at 190 ?

Yes.

 

If you move the sprites manually, then avoid a y-coordinate of >d0, which is the end of sprite list indicator (hardware).

Link to comment
Share on other sites

Ok that's over my head could you dumb it down a shade ? For example if I write 254 to the Y location will that place the sprite 1 pixel above the screen while 253 would be 2 pixels above the screen ?

 

Yes, until you get to 224, which is the "wrap around" point to the bottom of the screen (but still in the invisible area.) Basically it goes like this:


Sprites below are 32x32 (magnification is on, pixels are "fat")

Y
---
225    xx...xx
226    xx   xx   xx...xx
.      .     .   xx   xx
.      .Y@225.   .     .
.      .     .   .Y@226.
253|   xx   xx   .     .
254|   xx...xx   xx...xx
---+--------------------------------------------
255|             xx...xx   xx...xx
 0|                       xx   xx   xx...xx
.  |                       .     .   xx   xx
.  |   Active screen area  .Y@255.   .     .
.  |                       .     .   . Y@0 .
29|                       xx   xx   .     .
30|                       xx...xx   xx   xx
31|                                 xx...xx
.  |
.  |
.  |
191|
---+---------
192|
.  |  Bottom border area
.
.
208 <-- disables any sprites after this one
209
.
.
.
224

Link to comment
Share on other sites

An easy way to think of it might be to just assume that the height is still 256 pixels, and sprites wrap around, with row 255 as the first line of the screen. Anything on row 191 or lower is not visible since it's off the bottom. Sometimes it's easier just to remember the facts than to understand why they are that way.

 

(Actually, maybe that's not easier, but I'll leave it up anyway, just in case. ;) )

Link to comment
Share on other sites

An easy way to think of it might be to just assume that the height is still 256 pixels, and sprites wrap around, with row 255 as the first line of the screen. Anything on row 191 or lower is not visible since it's off the bottom. Sometimes it's easier just to remember the facts than to understand why they are that way.

 

(Actually, maybe that's not easier, but I'll leave it up anyway, just in case. ;) )

 

 

I finally figured out my issue. I was working on the sprite/background checking routine and had a problem when the sprite went above the screen. Turns out I needed to mirror the first line of graphics at the end of my screen table. Done and everything works as advertised. I'll post the code as well as a demo for a new game I am working on using this method tomorrow. It's 10:00 PM. here and well past my bed time ;-).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...