Palette Manipulation

Get help using Construct 2

Post » Tue May 29, 2012 2:49 pm

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.
B
15
S
2
G
3
Posts: 45
Reputation: 2,638

Post » Tue May 29, 2012 6:22 pm

I think it might be possible with webGL in a custom plugin, but not in vanilla C2 at the moment.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed May 30, 2012 10:55 am

@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.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Thu May 31, 2012 11:47 am

@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.
B
15
S
2
G
3
Posts: 45
Reputation: 2,638

Post » Thu May 31, 2012 12:01 pm

@CyberDagger : when I have less work (in another lifetime), I'm planning to add a 'selective color replacement' for the plugin.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Thu May 31, 2012 2:54 pm

@Pode
[QUOTE=Pode](in another lifetime)[/QUOTE]
Let's hope I don't reincarnate as a turkey then.
B
15
S
2
G
3
Posts: 45
Reputation: 2,638


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, Radulepy and 6 guests