How do I store color as text?

0 favourites
  • 6 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hi,

    What would be the best approach to store color of a sprite (as in set by "set color") so that in can be later retrieved and set to another sprite?

    So far I found the ColorValue expression but I'm not sure how is it calculated? Can individual values of r, g and b be extracted from the long number it outputs?

    Thanks!

  • They way I would solve it is make a separate animation for the second sprite in the color of the first sprite and the n when you want to change the color just change the animation. I'm sorry for my lack of technical knowledge I am more of a story and quest writer but that is what I would personally do

  • Simply write ColorValue into some variable (e.g. store it in Dictionary) & retrieve it when you need it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Perhaps try having a global variable for each RGB #, and then referencing that?

    Perhaps not the most elegant solution, but it works.

  • The result of any color expression (rgba, rgba255, rgbex, rgbex255) is an integer number. So you can just store this number in a variable and re-use it when you need it.

    Set c to rgba(100,20,20,100)
    Sprite set color to c
    
  • The result of any color expression (rgba, rgba255, rgbex, rgbex255) is an integer number. So you can just store this number in a variable and re-use it when you need it.

    > Set c to rgba(100,20,20,100)
    Sprite set color to c
    

    Great thanks! Would you happen to know how is this number calculated? I.e. is it possible to convert it to some other format externally (hex?) or pre-calculate it from rgb values and use directly without reading ColorValue?

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