I'm working on a character creator for my game and have been trying to use the TintMatrix transform to recolor the sprites I'm using rather than recolor them separately. The part that I'm stuck on is how to get a tint to apply across different sprites in the same category, i.e. choosing a hair type and then a hair color.
Below are my default variables:
Code: Select all
default hair = 1
default brows = 1
default nose = 1
default mouth = 1
default body_color = 1
default hair_color = 1
$ body_tint = "#FFFFFF"
$ hair_tint = "#FFFFFF"
Code: Select all
layeredimage Player:
always:
"images/character_creator/cc_base.png" matrixcolor TintMatrix(body_tint)
always:
ConditionSwitch(
"nose==1","images/character_creator/cc_nose_1.png",
"nose==2","images/character_creator/cc_nose_2.png") matrixcolor TintMatrix(body_tint)
group brows:
attribute brows_normal default:
ConditionSwitch(
"brows==1","images/character_creator/cc_brows_1.png",
"brows==2","images/character_creator/cc_brows_2.png") matrixcolor TintMatrix(hair_tint)
attribute brows_raised:
"images/character_creator/cc_brows_raised.png" matrixcolor TintMatrix(hair_tint)
group mouth:
attribute mouth_normal default:
ConditionSwitch(
"mouth==1","images/character_creator/cc_mouth_1.png",
"mouth==2","images/character_creator/cc_mouth_2.png") matrixcolor TintMatrix(body_tint)
attribute mouth_smile:
"images/character_creator/cc_mouth_smile.png" matrixcolor TintMatrix(body_tint)
always:
ConditionSwitch(
"hair==1","images/character_creator/cc_hair_1.png",
"hair==2","images/character_creator/cc_hair_2.png") matrixcolor TintMatrix(hair_tint)
Code: Select all
hotspot( 90*7, 47*7, 5*7, 7*7) action [SetVariable("body_color",If(body_color==1,6, body_color-1)), Call("set_body_tint")]
hotspot(130*7, 47*7, 5*7, 7*7) action [SetVariable("body_color",If(body_color==6,1, body_color+1)), Call("set_body_tint")]
hotspot( 94*7, 63*7, 5*7, 7*7) action [SetVariable("brows",If(brows==1,3, brows-1)), Call("set_hair_tint")]
hotspot(126*7, 63*7, 5*7, 7*7) action [SetVariable("brows",If(brows==3,1, brows+1)), Call("set_hair_tint")]
hotspot( 90*7, 79*7, 5*7, 7*7) action [SetVariable("nose",If(nose==1,2, nose-1)), Call("set_body_tint")]
hotspot(130*7, 79*7, 5*7, 7*7) action [SetVariable("nose",If(nose==2,1, nose+1)), Call("set_body_tint")]
hotspot( 90*7, 87*7, 5*7, 7*7) action [SetVariable("mouth",If(mouth==1,3, mouth-1)), Call("set_body_tint")]
hotspot(130*7, 87*7, 5*7, 7*7) action [SetVariable("mouth",If(mouth==3,1, mouth+1)), Call("set_body_tint")]
hotspot( 98*7, 103*7, 5*7, 7*7) action [SetVariable("hair",If(hair==1,3, hair-1)), Call("set_hair_tint")]
hotspot(122*7, 103*7, 5*7, 7*7) action [SetVariable("hair",If(hair==3,1, hair+1)), Call("set_hair_tint")]
hotspot( 90*7, 104*7, 3*7, 5*7) action [SetVariable("hair_color",If(hair_color==1,2, hair_color-1)), Call("set_hair_tint")]
hotspot( 94*7, 104*7, 3*7, 5*7) action [SetVariable("hair_color",If(hair_color==2,1, hair_color+1)), Call("set_hair_tint")]
Code: Select all
label set_body_tint:
if body_color == 1:
body_tint = "#C9823E"
elif body_color == 2:
body_tint = "#734C27"
call screen chargen
label set_hair_tint:
if hair_color == 1:
hair_tint = "#DED6CE"
elif hair_color == 2:
hair_tint = "#3F75BA"
call screen chargen
Is it possible to do something like this? Any help would be super appreciated.