#12165 - yaustar - Sat Nov 01, 2003 8:07 pm
at the moment I am trying to write a function to edit the colour an pixel in a particular sprite along the lines of
editSprite(x,y, colour){}
but am unsure of how the data in sprites is stored.
Using 256 colour sprites the data is stored as a 16 bit number
I am guessing that each half of the data represents a pixel with a colour index according to the palette.
My problem is which pixels is it referring to?
imagine an 8x8 sprite in pixels
does the data represent the pixels 0 and A as:
or 0 and 1
and then what does the next data in the array represent? The X and X below it or 1 and B next to it across or 2 and 3/A and B.
If you are still reading at this point then thanks and any help clarifing this would be appreciated.
Side note. I understand that larger sprites and divided into 8x8 squares left to right then the next row down.
_________________
[Blog] [Portfolio]
editSprite(x,y, colour){}
but am unsure of how the data in sprites is stored.
Using 256 colour sprites the data is stored as a 16 bit number
Code: |
BBBB BBBB AAAA AAAA |
I am guessing that each half of the data represents a pixel with a colour index according to the palette.
My problem is which pixels is it referring to?
imagine an 8x8 sprite in pixels
Code: |
01234567 ABCDEFGH XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX |
does the data represent the pixels 0 and A as:
Code: |
0000 0000 AAAA AAAA |
or 0 and 1
Code: |
1111 1111 0000 0000 |
and then what does the next data in the array represent? The X and X below it or 1 and B next to it across or 2 and 3/A and B.
If you are still reading at this point then thanks and any help clarifing this would be appreciated.
Side note. I understand that larger sprites and divided into 8x8 squares left to right then the next row down.
_________________
[Blog] [Portfolio]