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

0 favourites
  • 7 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • 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?

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • exactly what SNN135 said, here's a capx doing that

    https://www.dropbox.com/s/6zc6witohn1i6 ... .capx?dl=0

  • 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

  • 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.

  • ok, thanks for the help

  • 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

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