How to access SetColor parameters?

0 favourites
  • 4 posts
  • Let's say I have a sprite called Ball and one called Paint, each of which has the SetColor effect on it. When a Ball collides with a Paint, I want the ball to become the same color as the Paint sprite. Intuitively I'd create an event that says:

    Ball | on collision with Paint ->

    Ball | Set effect "SetColor" parameter 0 to Paint.SetColor(0)

    Ball | Set effect "SetColor" parameter 1 to Paint.SetColor(1)

    Ball | Set effect "SetColor" parameter 2 to Paint.SetColor(2)

    That is, I want to read each of the R, G, and B values in the Paint sprite and write those to the R, G, B values of the Ball sprite. My problem is, Paint.SetColor(0) is an invalid expression, and I'm not sure how to access those parameters. I can set them just fine, just not read them.

    One work around I thought of is to give each sprite a R, G, and B instance variable and every frame set the SetColor parameters to those values, but that seems like an unnecessary duplication of data to me... unless of course there's no other way.

    So yeah, long story short: I can set the parameters of an effect, but how do I read them?


  • Sounds like Instance variables is your thing to do. I think you cant read effect parameters as you want to.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, it looks like you're right. I've been doing it that way though, and it's not so bad.


  • I would say "no, you can't do it for the complete sprite!", because a picture or sprite has normally not only one color, which you could read out. Every point of that picture has its own color and alpha.

    But I'm giving here my +1 vote for such an expression, which returns the RGBA values of a sprite Image Point number, i.e. the Origin or the custom Image Points under Edit animations...

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