Using "SetColor" Effect

0 favourites
  • 1 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • UPDATE: I had forgotten about the change/addition using the rgba expression. Details can be found here in a similar post to my own issue here. link:


    I'm trying to update objects on my HUD to reflect progressive changes in the game objects they represent.

    As the game objects take damage, the respective HUD elements will go from green (to yellow) to red.

    Per the properties bar, the SetColor effect lists the RGB color values as [RRR, GGG, BBB].

    When updating the values on the event sheet(s) via actions, you have to specify which 0-based parameter you want to affect... 0 for red, 1 for green, 2 for blue - each one having its own action line.

    Initially, the values start out as follows:

    RED: 0

    GREEN: 255

    BLUE 0 (and will never be changed)

    I'm using the two following action lines:

    - SetColor: Parameter 0 (red): round((100-Car.Integrity_Body_End))/100*255

    - SetColor: Parameter 1 (green): round(Car.Integrity_Body_End)/100*255

    The instance variable Integrity_Body_End is the strength of that part of the car object, with value 100 being full strength and 0 being destroyed.

    So an undamaged car would basically be 100/100*255...or 255. The color green should yield a green object on the HUD display. Naturally, as the car takes damage, the "100" value will decrease.

    As the green value goes down, the red value should inversely increase (using the difference between the variable value and 100...the difference then divided by 100 and the yielding fraction multiplied by 255.


    What results is a greyed-out or black object. The starting RGB value for the object is [000,255,000] And yet any attempt to affect this effect turns...heh...well, dark.

    What am I doing wrong?

    Thank you for your help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)