Hi all,
This is a bit messy to describe but I think it’s an interesting topic and I hope someone can shed some light for me.
There is a problem I’ve been toying with and I can’t find a ‘good’ solution.
I’m working on a bunch of flash games. The animation style doesn’t lend itself fully to automated tweening. Some things need to be redrawn on occassion. An example is a shoe. When the character walks, we have a few frames of handdrawn keyframes as the toe bends compared to the rest of the foot.
So far, so good.
I want - at a future date - to allow players to choose their character’s colours and have them replace existing colours on my graphics.
For example, the girl character has tights with two tones. Just now, they are both shades of green. In the future, I will store (via ‘normal’ web site back end) profile informatin for each player and will allow them to chose two tones to repllace those on the tights.
Again, so far so good.
In theory.
As far as how to do this… forget the ‘colour picking’ part - that’s easy. And ignore the webby back end bit - that’s easy too.
But as far as I can see, when I apply a colour transform to a MovieClip, it changes the whole clip’s colour.
This means that I need my artist to break each individual graphic she draws into a few movie clips and give the instances names.
I have been thinking that I would swap the colours in a fashion similar to this pseudocode:
start game
place character MC on the stage, invisible.
maintain a list of MC's (so far, just player avatar)
while ( MC list != empty) {
get next movie clip
examine each property of clip and if "instanceof MovieClip" is true, add it to my list
examine "_name" of the MC to see if it contains a predefined word (such as "skintone" - so 'ankle_skintone')
if (match) {
look up table and apply colour transform
}
}
OK. so you may suggest a better route - but in a very small demo, this works fine.
BUT!
Because the animation has redrawn keyframes, when I hit a new keyframe for whatever MC needs one, the NEW drawing hasn’t had its colours changed.
It’s obvious, and I can see why (it’s not on stage in my initial loop).
What isn’t obvious is how I can fix this issue.
Now, I COULD make sure that the animator places each component-graphic on the stage in the MC’s initial frame - and manages key framing by controlling x/y and _visible - but that’s a bit messy.
I could also ask the artist to put a function call or something in every key frame, but IMHO that’s a terrible idea! - It’s messy, it spreads my code all over the place… it has an artist programming… bad bad bad.
The whole thing is quite messy already actually, because it requires such careful breaking down and building up of MC’s.
So…
I have either one question or two!
“The one question version”
Can you advise how, with my current implementation idea, I can access ‘future’ MC’s - so with a ‘leg’ MC, not just access the current ‘tights_dark_green’ and ‘tights_light_green’ areas, but also the future MC’s corresponding areas?
“The two question version”
Is there a better way to do this ( ‘“palette switching” actionscript’ Google searches didn’t show up much)?
So…
Thanks for anyone who got this far!
Any advice or suggestions would be much appreciated.
Muchos Grazias!
David