How do I reference color value

0 favourites
  • 10 posts
From the Asset Store
HSV RGB Color Picker and Converter for Construct 3
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That question can only be answered if we know in what way you give the sprite the colour..

  • 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?

  • 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..

  • OK, thanks. I was hoping to avoid animation frames but if it's inevitable... I'll go with frames.

  • 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 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

  • 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 think It would be a bit of a mess when referencing it all in events.

  • Sprite on collision with wall

    Sprite animation = "red"

    sprite destroy

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