How do I Apply absolute color programmatically?

Get help using Construct 2

Post » Mon Jan 26, 2015 6:38 pm

Hi there,

I have a project i'm working on where I have a series of tiles that are set by RBG values, the problem is that i'm having issues where my webgl effect "set color" seems to have a few that display the RGB values I define correctly. See image below:

Image

nevermind that the word blue is green.. :) that's part of the game. What I want is for the world "blue" to be the exact same green as what you see in the box on the left. for some reason it comes out faded looking. i have 9 colors and most of them are dead on, however orange, purple and pink

The image below should make the text look orange done like this:
Image

but instead it comes out a yellow with a weird hint of red around the edges:
Image

The text you see are white (255,255,255) and i'm wondering if that might be the issue, but i'm not sure what other color / effect I could use that would absolutely assure a sprite is the exact color it needs to be.

here is what i have it setup with in the effect of the text sprite object:
Image

I've been stuck on this for a couple days trying things and for awhile i thought it was a logic thing, but the objects are right in the game and appear as they should, it's just that a few of them refuse to show the right exact color

Thanks!
Caleb
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Mon Jan 26, 2015 6:59 pm

The color values should be between 0 and 100.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Mon Jan 26, 2015 7:01 pm

ooooooo .. but then how do i calculate colors from RGB? if i use a color picker I get these values.. also strangely enough.. colors like blue:

r - 0
g - 0
b - 204

look perfect as best I can tell, however looking closer blue isn't perfect.. it is off.. just not as noticeable. do i still use the parameter 0 1 and 2 for RGB?
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Mon Jan 26, 2015 7:09 pm

doing some mad math.. i did try just now to divide a value say.. green which is:

R - 51
G - 153
B - 51

and i simply divided the value above by 255 (maybe i should do 256?) and i got basically:

R - 20
G - 60
B - 20

which looks dead on.. weird they would use a color range like this. is there some standard system that uses color in a range of 100? I've never seen that before.. or overlooked it in photoshop
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Mon Jan 26, 2015 7:10 pm

You can divide by 255 and multiply by 100. So, your orange value will be:
parameter 0: 226 / 255 * 100
parameter 1: 146 / 255 * 100
parameter 2: 28 / 255 * 100

I suppose if you use a value larger than 100 it just gets rounded down so (0,0,204) = (0,0,100) which is pure blue.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Mon Jan 26, 2015 7:22 pm

Took a while to find but I knew there was an old thread discussing why 0-100:
viewtopic.php?f=146&t=76577&p=633697
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Mon Jan 26, 2015 7:27 pm

yea i think you're right about the round off stuff... and ok yea 0-100.. percent.. duh.. didn't even think of it like that.
B
59
S
9
G
1
Posts: 942
Reputation: 6,553


Return to How do I....?

Who is online

Users browsing this forum: Darknessed, dop2000, matriax and 38 guests