0 Favourites

How do I change palette colors?

  • I mean in the style of Megaman series, and I do not mean simply changing the hue.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • I found it, but can't seem to change anything via the event editor.

  • Using the Replace Color effect, right? This is how I did it:

    [attachment=1:1sbl4uau][/attachment:1sbl4uau]

    I have the 3 Replace Color effects on it, one for each color, and the R,G,B Source is already set to the default colors of the sprite.

    I also have the palette values on a CSV table, that's the whole bold part of the event, getting the correct color from the CSV

    And this is the result:

    [attachment=0:1sbl4uau][/attachment:1sbl4uau]

  • Hmm, have no idea what you mean about a CVS table.

  • You don't NEED to do it, I just did it to keep my code clean, but you can add all colors by hand.

    On function "ColorChange"
        Parameter 0 = 0
            : Set effect "ReplaceColor1" parameter 4 to R1
            : Set effect "ReplaceColor1" parameter 5 to G1
            : Set effect "ReplaceColor1" parameter 6 to B1
        Parameter 0 = 1
            : Set effect "ReplaceColor1" parameter 4 to R2
            : Set effect "ReplaceColor1" parameter 5 to G2
            : Set effect "ReplaceColor1" parameter 6 to B2
    [/code:3rbapyly]
    Where parameter 0 is the "id" if the color, and R1B1G1 is the first color, R2B2G2 is the second color and so on
  • Ah, okay, so is the parameter like a single digit integer?

  • Yeah. Parameter 1, 2 and 3 is the original color you want to change R, G and B. Param 4, 5 and 6 is the R, G and B of the color you want it to be

  • 7Soul - I hate to bring back an old thread like this, but from what I understand, replace color has limited support in terms of browsers and mobile devices. Is that correct?

  • mudmask No problem. I guess it'll only work on a platform that supports webgl

  • Isn't parameter 6 (7th parameter but 0-index based) the tolerance? I think 0,1,2 are source colors and 3,4,5 are new colors

    I have a problem with the tolerance, what value should I use if I only want the exact color (source) to be replaced and nothing else?

    I tried 1 or 0 or 30 or 50 or 100, seems there are some pixels (of source color) still not being recolored

  • mudmask No problem. I guess it'll only work on a platform that supports webgl

    Ah, yeah that's what I gathered. Is there a way to force it on different devices? I'd love to incorporate this in a way that's a little less optional (similar to your mega man example). I got it working on some browsers, but not my phone or tablet.

    sgn15 - I would assume it's because you have some variations in the color of your sprites, but cranking the tolerance up should help (at least from a Photoshop perspective). You might have to take note of what pixels aren't changing, go through your sprites and make sure they're all the exact same RGB value.

  • mudmask

    ACtually what I really want is Photoshop's Indexed color mode, but as far as I know "Replace Color" is the only way to recolor in C2 (not counting the mask effects available.

    Or do you know another way of achieving indexed color mode in C2?

  • sgn15 unfortunately I don't, there may be a plugin that someone put together with that sort of functionality. I wish there was something like that I could implement in way that wasn't 'optional' too. but hey - that's how it goes.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)