multiple sprites

Post Reply
codycox.c
Posts: 49
Joined: Thu Mar 08, 2012 2:26 am

multiple sprites

Post by codycox.c » Sat May 19, 2012 1:26 am

I made a game and I only have on sprite and I want to put some more in my game. I used dmaCopy to copy the tiles and palette. I copied the palette to SPRITE_PALETTE. Where would I copy the other sprites' palettes?

mtheall
Posts: 210
Joined: Thu Feb 03, 2011 10:47 pm

Re: multiple sprites

Post by mtheall » Sat May 19, 2012 7:43 am

Ideally, you want them to all use the same palette. If that's not an option, then you need to use extended palattes. You will run out of palettes very quickly if you use a different one for each sprite. There are only 16 available in extended palette mode.

bttf
Posts: 7
Joined: Sat May 19, 2012 2:23 pm

Re: multiple sprites

Post by bttf » Mon Jun 04, 2012 5:17 am

If I'm not mistaken, you have to assign a location for each 16 color palette you allocate for your sprites. The first one would start at [0], but for example if you were to insert the third palette you would do something like SPRINT_PALETTE[3 * 16]. What I have seen done (and also personally do) is to use the sprites ID number as a multiplier: SPRITE_PALETTE[sprite1.id * 16].

mtheall
Posts: 210
Joined: Thu Feb 03, 2011 10:47 pm

Re: multiple sprites

Post by mtheall » Mon Jun 04, 2012 5:26 am

Sure, you can use 4bpp sprites and have each sprite use one of the 16 rows in the main palette. I just make all my sprites the same 8bpp palette and not bother with having to choose a palette slot, which also doesn't limit me to 15 colors per sprite.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests