Krunkcleanup Posted May 17 Share Posted May 17 (edited) I'm working on a game that uses player1colors. Sometimes I want a sprite to be multi-color, but sometimes i want to make a very large sprite a single color, and sometimes change that single color too. Redefining player1color for every single color would take up a lot of ROM like this. I came up with this idea where I store all the color data in RAM and use a loop. I was wondering if anyone has a better way of doing the same thing. asm ldx #<r000 stx player1color lda #>r000 sta player1color+1 end w000=$42 for temp5 = 0 to 27 : w001[temp5] = r000 : next Edited May 17 by Krunkcleanup Quote Link to comment Share on other sites More sharing options...
LatchKeyKid Posted May 17 Share Posted May 17 Are you using bB or ASM? I'm a programming n00b at this point but could you do a single array/table/whatever they're called in bB and have a point to it instead? Quote Link to comment Share on other sites More sharing options...
Krunkcleanup Posted May 17 Author Share Posted May 17 I'm using bB with a few snippets of asm here and there (my asm skills aren't that good yet). Normally with player1colors you need to set a color value for every line. player1color: $42 $42 $42 $42 $42 $42 $42 $42 $42 $42 end If I want a different color, i need a whole new table of repeated values like the last one, and when they're all the same color it seems pretty wasteful for ROM. Without the player1colors kernel option, you just set COLUP1 = $42, which takes up very little ROM in comparison. So I could make a sub for redefining all the colors, but I still would need a table of repeated values for color I want the sprite to be. When I want a sprite to be one color, what I need is to change one value, and have them all be that value without manually doing each line. I'm not sure how the kernel works, but I'm guessing that it advances the location of the color data every scanline by 1. 1 Quote Link to comment Share on other sites More sharing options...
LatchKeyKid Posted May 17 Share Posted May 17 Sorry, I mistakenly thought you meant that you'd have a separate variable for each line and not just one for the whole thing. I don't see why you couldn't use a single variable and define each one line as that variable... and then just change that variable as needed. I'm hoping to do something similar with my very early attempt at a first game with different colored enemies (with different stat blocks). Have you tried doing that in a quick build? I might try it later tonight myself. Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted May 18 Share Posted May 18 Using Superchip RAM as a player1color buffer is probably your best option within bB to have mixed single-color and multi-color sprites. 1 Quote Link to comment Share on other sites More sharing options...
LatchKeyKid Posted May 18 Share Posted May 18 17 hours ago, Krunkcleanup said: If I want a different color, i need a whole new table of repeated values like the last one, and when they're all the same color it seems pretty wasteful for ROM. Without the player1colors kernel option, you just set COLUP1 = $42, which takes up very little ROM in comparison. So I could make a sub for redefining all the colors, but I still would need a table of repeated values for color I want the sprite to be. When I want a sprite to be one color, what I need is to change one value, and have them all be that value without manually doing each line. I'm not sure how the kernel works, but I'm guessing that it advances the location of the color data every scanline by 1. Are you trying to make a multicolored sprite mixed with a single colored sprite? I use player1colors in my first just started WIP project and I tried it with the single color player0 sprite and it worked fine using COLUP0. Are you trying to mix multicolor and single within the same coding color sprite? Or do you just want a variety of sprite colors with the same shape like in old NES games? If it's the latter then you can just instead use the monochrome player0 sprite for color swaps and leave the player1 sprite for characters you want to have multiple colors at the same time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.