Gb-studio: [Request] Sprite with 4 colors instead of a transparency color.

Created on 24 Apr 2019  路  7Comments  路  Source: chrismaltby/gb-studio

Hey, I really love your program!

I was gonna ask if it's possible to have a sprite with the same colors as the background images.
test
I want to display this monster in the middle of the screen as 4 16x16 sprites, rather than part of the background, so that I can easily replace the sprites with other monster sprites. I don't need a transparency for these kind of sprites... so maybe it's possible to make transparency color an option but not mandatory?

Cheers!

Most helpful comment

It's technically possible to choose which colour is used as the transparent one for the sprites, so you could have the lightest colour being transparent and as long as you kept the sprite on the light background you could use all four colours.

I've not exposed this just yet though as for everything I'm adding I want it to be as simple as possible and there's definitely some awkward things around this. For instance you can have two different palettes for sprites but only two, so if you wanted one sprite where the darkest colour was transparent, and one sprite where the mid colour is transparent that's fine, but if you then wanted a third sprite where the lightest colour was transparent, well you can't.

The other thing to consider is during fade in and fade out of scenes, I cycle the colours used in the sprite palette to do the effect, if these are changed, will also need to make sure the fades still work as expected.

It's all possible just need to work out the user friendly way of handling it and how to keep it not too messy in the engine.

All 7 comments

A quick workaround is to make your background be the color you are missing from the sprite.

Yeah, I guess I could do that but that's not really what I want. It doesn't look so good on a dark background. The color that's replaced for the transparency is the dark color #306850.

Yeah, I wish you could at least choose which color is transparent for sprites

Indeed! That way I could simply make the lightest color, #e0f8cf, be the transparent color. Hopefully it'll be implemented in the future.

It's technically possible to choose which colour is used as the transparent one for the sprites, so you could have the lightest colour being transparent and as long as you kept the sprite on the light background you could use all four colours.

I've not exposed this just yet though as for everything I'm adding I want it to be as simple as possible and there's definitely some awkward things around this. For instance you can have two different palettes for sprites but only two, so if you wanted one sprite where the darkest colour was transparent, and one sprite where the mid colour is transparent that's fine, but if you then wanted a third sprite where the lightest colour was transparent, well you can't.

The other thing to consider is during fade in and fade out of scenes, I cycle the colours used in the sprite palette to do the effect, if these are changed, will also need to make sure the fades still work as expected.

It's all possible just need to work out the user friendly way of handling it and how to keep it not too messy in the engine.

So to do this we would just use different 3 colors (from the 4 color palette) for our sprites?

Also, not everything has to be user friendly in UI. In Bitsy (another very limited engine for making tiny games) there are "hacks" that let you push the game a bit over what is available through UI and using/discovering them is a part of the community :)

The Game Boy hardware maps color #0 of a sprite to transparency. The only way to have 4 colors in a sprite is to overlap sprites, which has the downside of double sprite usage, as well as hitting the 10-per-line limit.
As rightfully pointed out by @chrismaltby, this implies using both sprite palettes, which means both have to be animated at the same time whenever either is.
Cycling through the palette is not recommended if non-gradient palettes are to be used, and for this purpose I wrote some code that fades palettes the proper way. It's ASM, but logic can be extracted and converted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cubicstyle picture cubicstyle  路  3Comments

kurosukee picture kurosukee  路  3Comments

timsamoff picture timsamoff  路  4Comments

mrcampbell picture mrcampbell  路  5Comments

Animacreep picture Animacreep  路  4Comments