How to set a FlxSprite's(loaded a image) brightness ?



  • How to set a FlxSprite's(loaded a image) brightness ?



  • You can make it darker by multiplying it with a particular colour. For example:

    mySprite.color = 0xff808080;
    

    If you want to make it brighter, there might be some trickery possible using ColorTransform in OpenFL, but I don't know the details about that. It might be simpler just to use an image editing program instead.



  • To make it brighter:

    var OFFSET = 64;
    
    sprite.setColorTransform(1, 1, 1, 1, OFFSET, OFFSET, OFFSET);
    

Log in to reply