vendredi 10 juin 2016

Color based on distance

I'm trying to make a simple tile lighting system in AS3 and the problem I've come across is that I have no idea how to change the color based on distance using hexadecimal color codes

heres the code for the color changing part:

for (var i:int = 0; i < buttons.length; i++) {
    lightFact = getDistance(lightSource, buttons[i])
    colorTransform2.color = 0x000000
    DisplayObject(buttons[i]).transform.colorTransform = colorTransform2;

lightFact being the distance from the lightSource, if you can't figure that out from the function name.

Aucun commentaire:

Enregistrer un commentaire