Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2022-02-10 10:01:52

M2m
Member
Registered: 2021-02-18
Posts: 27

DMG Single Sprite color palette change in GBDK2020

I try to figure out how to change the color palette (color) of a single sprite to different then the standard.

I want to display a white sprite (I know I can only use 3 colors, because the last color - typically white - will be used as transparent). So I want to change the color of the 2nd to last (light grey) to white.

I understand I have to define OBP0_REG from standard  11 10 01 00 to  11 10 00 00.

But how can I pass this to a specific sprite ??  set_sprite_tile(8, 0x58 ... ??? );

Offline

 

#2 2022-02-10 13:55:13

toxa
Member
Registered: 2020-02-13
Posts: 309

Re: DMG Single Sprite color palette change in GBDK2020

set_sprite_prop()

there are 2 sprite palettes: OPB0 and OBP1. sprite may use one or the other.

Last edited by toxa (2022-02-10 13:57:07)

Offline

 

#3 2022-02-10 22:01:32

M2m
Member
Registered: 2021-02-18
Posts: 27

Re: DMG Single Sprite color palette change in GBDK2020

toxa wrote:

set_sprite_prop()

there are 2 sprite palettes: OPB0 and OBP1. sprite may use one or the other.

Yay ! This worked.

I set:

OBP1_REG = 0b11000100;

And then 'flip' the palette bit

set_sprite_prop(34, (get_sprite_prop(34) | 0b00010000));


Many thanks again!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson