# How do I change a characters eye color based on a value?

Get help using Construct 2

### » Sun Jun 12, 2016 9:46 pm

Alright, so I'm making a platformer with some rpg mechanics. At the start of the game, you can adjust your character to dodge or attack better. I'd like the characters eyes to be blue if the character if defensive, purple if neutral, and red if agressive. The trouble is, the character has many different ~10 frame animations, but the characters eyes always are one square pixel. Whats the optimal way to go about changing the color of the characters eyes?
B
10
S
2
Posts: 20
Reputation: 622

### » Sun Jun 12, 2016 10:58 pm

If you don't want to alter every single animation, you could create a separate sprite for the eyes that are pinned to the player. Have the eyes consist of three different frames (blue, purple, and red), and update them accordingly based on whatever value you're using.

Someone else might be able to provide a better solution, but outside of adding different animations for every eye color, I can't think of an easier way to do it.
Ruby Winds: a top-down adventure game inspired by the Oracle series of Zelda games.
B
15
S
6
G
13
Posts: 55
Reputation: 7,530

### » Sun Jun 12, 2016 11:33 pm

exactly what SNN135 said, here's a capx doing that

https://www.dropbox.com/s/6zc6witohn1i6 ... .capx?dl=0
B
25
S
11
G
9
Posts: 136
Reputation: 6,657

### » Mon Jun 13, 2016 4:54 am

SNN135 wrote:If you don't want to alter every single animation, you could create a separate sprite for the eyes that are pinned to the player. Have the eyes consist of three different frames (blue, purple, and red), and update them accordingly based on whatever value you're using.

Does the value mean Global Variables ? Like Blue eye = 1 l Purple =1 l Red = 1

When the condition is active or trigger minus the blue = 0
At another event put : Sys l compare variable blue = 0
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

### » Mon Jun 13, 2016 5:49 am

Sure, you could do it like that. Have a variable for each eye color, and then you could do some thing like

System: Blue = 1
-> Set animation frame to <whatever number the blue frame is>

You would set Blue (or whichever color you use) to 1 when the animation should play, and to 0 when it shouldn't.
Ruby Winds: a top-down adventure game inspired by the Oracle series of Zelda games.
B
15
S
6
G
13
Posts: 55
Reputation: 7,530

### » Tue Jun 14, 2016 11:36 pm

ok, thanks for the help
B
10
S
2
Posts: 20
Reputation: 622

### » Wed Jun 15, 2016 7:51 am

You could also use a single variable, 1=blue 2=purple 3=red - or set it as a string variable and have actually written "blue" or "purple" or "red".

I have a similar setup with my character blueprint for my project, where the character is made up of about 50 parts and each part can be changed to look differently based on a string variable, for example "Male" or "Female" will change the appearance of parts to be male or female. This can easily be extended to make clothing options, hair styles, or in your case - eye colour.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
41
Posts: 3,032
Reputation: 30,999