#White sprite defaults to blue? - Character customization

49 messages · Page 1 of 1 (latest)

worn halo
#

I'm making a prototype of a character customization system, following a tutorial so I can look back and see anything I might've messed up.

The problem: My sprites are white, they appear white in the engine, but as soon as I run the game they turn blue.

Possible issue: I used hex code instead of RGB like the tutorial did, but I thought I had implemented it well after reading through the Color section of the Godot Documentation.

The first color in the color selection array is NOT blue, not even close, so I'm a bit confused as to why this is happening. Any suggestions?

Attached are a screenshot within the engine, a screenshot within the game, a screenshot of the color code and also what the first color of the list is SUPPOSED to look like

Let me know if more information is needed

faint karma
#

For the record there's a pre-made color picker already built into Godot you could use
But for now can I see your scene tree on the character and the code that's setting the color?

#

@worn halo

worn halo
#

Oh! Yes yes one second, sorry

worn halo
#

Using the color picker would be easier but I was curious to see this method in action

#

each of the node2d in the first screenshot have sprite2d inside

#

also @iron fractal you deleted what you sent right after sending it so I didnt get to read it fully

iron fractal
#

I was wrong, i assumed the first option was cyan, but you already showed it isn't
Still, you ARE automatically setting the color to the first value in the list, as update_sprite() is called on _ready() and starts with index 0

faint karma
#

Which is intended behavior afaik.

worn halo
#

Yes that is intended, technically

#

At least in this current application

iron fractal
#

yeah, but there could be somthing shifting the values, or there could be some weird interaction with the modulation, idk

#

Do note that 0xfffffa is treated as an integer.
You are using the Color( value: int ) constructor

faint karma
#

Yeah.
I think you can safely skip that first update call in ready but that doesn't solve the mystery

worn halo
#

Would it be better for me to scrap this and use a Color Picker instead?

#

in yalls opinion

iron fractal
#

nvm, i am also wrong

worn halo
#

No problem, take your time
And thank you guys for stopping to help :')

iron fractal
# worn halo No problem, take your time And thank you guys for stopping to help :')

Ok, i found the issue now i think.
Color.hex() Expects a hex value with with 8 digits, yours only have 6
You provided RGB, you need to provide RGBA
https://docs.godotengine.org/en/stable/classes/class_color.html#class-color-method-hex

faint karma
#

OOOOH NANCOK YOU GENIUS

worn halo
#

Oooohhhhhhh

faint karma
#

IT'S LEFT PADDING IT

worn halo
#

That makes so much sense as to why this is happening, thank you!!!

faint karma
#

0x00fffffa is indeed transparent cyan gdwheeze

worn halo
#

Reading a bit more of the documentation I think the color values i copy pasted were actually HTML

iron fractal
#

Ah, there is a separate function to take in HTML values

worn halo
#

I'll try using that then and see what happens, thank you so much!

#

Yall are both awesome, have a great day!

faint karma
#

You're welcome

worn halo
#

I just finished changing the colors and tried to boot up the build and it gave me this error-

faint karma
#

How did you update color options?

worn halo
#

I went in and changed Color.hex to Color.html_is_valid on each one

faint karma
#

Now look at the tool tip for html_is_valid while I go grab the right function

worn halo
#

oop

#

will do

faint karma
#

You just need html

#

is_something type methods usually return true and false and nothing else. Not colors

#

You're asking if the color is a real color

worn halo
#

Ooohhhh

faint karma
#

And so you're setting a color to "yes"

worn halo
#

Alrighty
I'm sorry, but where do I put the html? My brain is really fried right now, im sorry

#

OH

#

NEVERMIND

#

IT CLICKED

#

mdhfvcberhdgsfbcyierhgdfs

#

so i just need to delete "is valid" from it?

faint karma
#

Yes