How do I get variable values of a sprite instance?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi, I'm trying to achieve something surely simple, but can't get it to work...

    For testing purpose, I want to be able to change the font color to a specified 5 color palette.

    So, what I did is create a sprite 30x30, white. then each sprite has it's own color, and 3 instance variables R G B, which is the RGB Values of each of the sprite's instances.

    I create a family with all my text objects in it. then created a function that changes the family's font color.. so I set rgbEx(Sprite6.R,Sprite6.G,Sprite6.B) That colors my texts the spectrum of colors LOL! some are blue, some white etc.

    So in plain words, what my head was telling me is to set the color to the Sprite.UID.R | Sprite.UID.G | Sprite.UID.B... but that's not accepted...

    so how can I access those specific variable? Can I use Sprite[x].R | G | B [x] being the UID id number...



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK.. so I figured it out... If anyone finds it useful.

    1. On click, I assign my insstance variables (R,G,B) to global variables (varR, varG, varB) so now those contains the colors of my clicked sprite instance.

    2. I then call my function. by default when you choose the action "change color" it gives u an rgbEx(0-100,0-100,0-100).. I had to change it to rgbEx255 ... where now I put in rgbEx255(varR,varG,varB).

    Works like a charm!


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