How to access SetColor parameters?

Get help using Construct 2

Post » Sat Feb 23, 2013 5:45 pm

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?

Thanks.
B
6
Posts: 38
Reputation: 533

Post » Tue Feb 26, 2013 12:58 pm

Sounds like Instance variables is your thing to do. I think you cant read effect parameters as you want to.
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Tue Feb 26, 2013 2:39 pm

Yeah, it looks like you're right. I've been doing it that way though, and it's not so bad.
Thanks.
B
6
Posts: 38
Reputation: 533

Post » Mon Jun 10, 2013 9:18 pm

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...
B
11
S
3
G
3
Posts: 79
Reputation: 3,343


Return to How do I....?

Who is online

Users browsing this forum: LeFuji and 27 guests