Jump to content
IGNORED

Mirrored sprite issue


STGuy1040

Recommended Posts

My main player sprite is mirroring itself and I am trying to figure out why. I've been reading about the NUSIZ0, NUSIZ1 commands and how they can make a mirror image of a sprite or how it can limit a sprite to a single and a single missile. I haven't used this command yet my player0 sprite is mirrored x2. I tried using the chart on the bB commands page.

 

Here is the file:

default.bas

Edited by STGuy1040
Link to comment
Share on other sites

My main player sprite is mirroring itself and I am trying to figure out why. I've been reading about the NUSIZ0, NUSIZ1 commands and how they can make a mirror image of a sprite or how it can limit a sprite to a single and a single missile. I haven't used this command yet my player0 sprite is mirrored x2. I tried using the chart on the bB commands page.

 

Here is the file:

default.bas

It's because of this section of code-- in particular, the statement "NUSIZ0 = 18":

 

mainloop
  COLUP0 = 122
  COLUP1 = 16
  scorecolor = 10 : NUSIZ0=18

"NUSIZ" stands for "NUmber" and "SIZe," and the two NUSIZ registers-- NUSIZ0 and NUSIZ1-- let you control the number of copies and/or the size of player0 and player1 (as well as missile0 and missile1). The lo nybble of each of these registers controls the number/size of the player and the number of its missile, whereas the hi nybble controls the size of the missile. The lo nybble recognizes eight values (bits 0 through 2; bit 3 is unused), and the hi nybble recognizes four values (bits 4 and 5; bits 6 and 7 are unused).

 

Here's how I remember the different values for the lo nybble:

 

There are three bits that are used in the lo nybble. You can have no bits on, only one bit on, two bits on, or three bits on.

 

If only one bit is on, you get two copies of the player (and its missile). The spacing between the two copies depends on which bit is on. Notice that if the lowest bit is the one that's on, you get the closest spacing, and the spacing increases as the on bit is shifted to the left:

 

%001 = 2 copies, with single-width pixels, with close spacing

%010 = 2 copies, with single-width pixels, with medium spacing

%100 = 2 copies, with single-width pixels, with far spacing

 

If only two *adjacent* bits are on, you get three copies of the player (and its missile). The spacing between each copy depends on which pair of adjacent bits is on. Again, if the lowest pair of adjacent bits is on, you get the closest spacing, and the spacing increases as the pair of on bits is shifted to the left:

 

%011 = 3 copies, with single-width pixels, with close spacing

%110 = 3 copies, with single-width pixels, with medium spacing

 

At the close spacing, there are 8 color clocks between each copy-- equivalent to one "blank" player between one copy and the next.

 

At the medium spacing, there are 24 color clocks between each copy-- equivalent to three "blank" players between one copy and the next.

 

At the far spacing, there are 56 color clocks between each copy-- equivalent to seven "blank" players between one copy and the next.

 

So far, we've listed five of the possible eight values. (Remember, only three bits of the lo nybble are used, so there are eight values.) The remaining three values give you only one copy, but the width of the pixels is determined by how many bits are on:

 

%000 = 1 copy, with single-width pixels

%101 = 1 copy, with double-width pixels

%111 = 1 copy, with quadruple-width pixels

 

Note that if you use two or three copies, they're always drawn with single-width pixels.

 

For the hi nybble, the values are as follows:

 

%00 = $0 = single-width missile

%01 = $1 = double-widh missile

%10 = $2 = quadruple-width missile

%11 = $3 = octuple-width missile

 

You're setting NUSIZ0 to 18, which is 16 plus 2-- $12 in hexadecimal, or %00010010 in binary. That means the hi nybble is $1 or %01, so you'll get a double-width missile. And the lo nybble is $2 or %010, so you'll get two copies of the player and two copies of the missile, separated by the medium spacing.

 

Michael

Edited by SeaGtGruff
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...