Palette Manipulation

  • Here's the deal. In my game, I'm going to need to change the colors of various objects at many points, both permanently and temporarily.

    The best way to do this is to do it like in the old fighting games with Player 2 colors. The sprite is exactly the same, it just loads a different palette to go with the sprite.

    This is optimal both on my end, as it would mean less sprites for me to take into account, and on the user's end, as it would mean less loading time.

    So, is there any way for C2 to load palette files and apply them to sprites? Some plugin that does it? Or is it simply impossible right now with HTML5? Any answer would be great.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think it might be possible with webGL in a custom plugin, but not in vanilla C2 at the moment.

  • CyberDagger : it's not possible with the HTML5 Canvas to do what you want to do (because that means that some Javascript code would be able to sneak around some OS code in memory to swap the palette buffer). JS is strictly sandboxed.

    However, you can use a plugin (there are a few of them in the plugin section) to recolor a Sprite, by iterating over it's pixels, in JS.

  • Pode : I went and checked the plugins list, and I saw your color changing plugins. Pretty good, except they apply the filter to the whole sprite, they don't let me selectively change colors.

    I may be able to work around that, though. cut the sprites apart. For example, having a cockpit as a separate sprite that follows the main sprite. That might be a bit of work depending on how many sprites I have to do that with, but it may pay off.

  • CyberDagger : when I have less work (in another lifetime), I'm planning to add a 'selective color replacement' for the plugin.

  • Pode

    (in another lifetime)

    Let's hope I don't reincarnate as a turkey then.

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