Set Effect Parameter SetColor for Sprite

0 favourites
  • 6 posts
From the Asset Store
A total of 214 high quality and unique magic sound effects suitable for RPG, Battle Arena and more!
  • I have a plain, white sprite.

    I added a slider into my project to act as a color changer.

    In my logic I have:

    SliderBar -> OnChanged ---> WhiteSprite -> SetEffect "Color" to SliderBar.Value.

    The issue I'm having right now is that the SliderBar is only changing the R in the RGB values.

    I'm also not allowed to put comma delimited numbers in the value textbox. For example (SliderBar.Value, SliderBar.Value + 50, 0).

    Does anyone have any experience with coloring sprites and what an ideal practice should be for using the SetEffect properties?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Set effect parameter" takes values from 0 to 100 and for setting red, green and blue channels you need three actions, for example:

    Sprite-> Set effect "SetColor" parameter 0 to 50

    Sprite-> Set effect "SetColor" parameter 1 to 70

    Sprite-> Set effect "SetColor" parameter 2 to 100

  • So the above comment works for Construct 2, but it didn't work for me for Construct 3.

    I did some digging in the forums and actually found a solution:

    If the link above is no longer active for whatever reason, here's an abridged version of the solution:

    "@SteamPoweredPix Hi, I was having the same exact problem - it really seemed as though effects that require color parameters were just broken in Construct 3, but they're not! Here's how pass color values to effects now.

    Instead of the C2-style "parameter 0 = red, parameter 1 = green, parameter 2 = blue", C3 color parameters are just a single value of "rgb" type. To get that you use the System expression "rgb" and pass it three numbers between 0-255 (not 0-100 like in C2).

    CODE: SELECT ALL

    Solid red:

    Set effect "SetColor" parameter 0 to rgb(255, 0, 0)

    Solid green:

    Set effect "SetColor" parameter 0 to rgb(0, 255, 0)

    Solid blue:

    Set effect "SetColor" parameter 0 to rgb(0, 0, 255)

    Solid grey:

    Set effect "SetColor" parameter 0 to rgb(128, 128, 128)

    And so on. Hope this helps!"

    -- Quote is from JerkTheRipper

    Thanks!

  • Oh, sorry, I didn't know they changed it in C3.

  • I had forgotten about this change! Thank you for the reminder!

  • Everytime I'm getting stuck on something in Construct 3, it happens that there is a System expression I didn't know about... Ha ha. ^^

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