How do I reference color value

Get help using Construct 2

Post » Mon Jun 08, 2015 9:42 am

Hello everybody!

Is there a way to reference color value for comparison? For instance, if sprite hits a wall, destroy it, but only if the color of the sprite is red.
How do I get the color value for comparison?

Thank you!
B
8
S
1
Posts: 34
Reputation: 439

Post » Mon Jun 08, 2015 9:54 am

That question can only be answered if we know in what way you give the sprite the colour..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 11:20 am

Well, for now I only colored the sprite in a single color in sprite designer (regular rgb values). If it makes any difference I could do it with effect (change color or tint).
Is there a property like Sprite.color or something similar?
B
8
S
1
Posts: 34
Reputation: 439

Post » Mon Jun 08, 2015 11:47 am

No but you can reference the framenumber, animation, And if you use the hue effect it's parameters..

If for any reason, these ways won't work for your intended purpose, there is the third party plugin canvas which has a rgbAt expression if I'm not mistaken..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 11:54 am

OK, thanks. I was hoping to avoid animation frames but if it's inevitable... I'll go with frames.
B
8
S
1
Posts: 34
Reputation: 439

Post » Mon Jun 08, 2015 12:09 pm

Why would you want to avoid animation-frames?
If you have a good reason, there are always other ways..

Sprite.colour wouldn't make much sense btw, for most sprites consist of more than one colour..
You could always make an instance-variable colour for your sprite, but the question would again be how you change the colour of that sprite (if animation(frames) are out of the question)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 12:22 pm

I have animation frames which change the shape of sprite (8 different frames). So if I add 6 more color, I'll have 48 frames. But now I'll create 8 sprites with different shapes and each will have 6 colors (6 frames). Put it in the same family and it should work :)
B
8
S
1
Posts: 34
Reputation: 439

Post » Mon Jun 08, 2015 12:26 pm

I'm not sure having 48 frames in 8 different animations would be that big of an issue, but if this works for you, go for it!
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 12:33 pm

I think It would be a bit of a mess when referencing it all in events.
B
8
S
1
Posts: 34
Reputation: 439

Post » Mon Jun 08, 2015 1:38 pm

Sprite on collision with wall
Sprite animation = "red"
> sprite destroy
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: ladjuric, plinkie, Syazanie Amirin and 3 guests