samedi 11 juin 2016

Weird graphical bug in AS3?

So, I'm trying to make a grid of rectangles each get more transparent the closer the mouse is to it.

Using some basic maths, I thought I had got it, but instead it seems I got a weird graphic bug(maybe?) shown here

The middle of the rings is where the mouse is.

Part of code that deals with transparency:

private function update(e:Event = null):void
    for (var i:int = 0; i < buttons.length; i++) {
        lightFact = getDistance(buttons[i])
        lightBrightness = lightPower - (lightFact * 10)
        buttons[i].alpha = lightBrightness

getDistance is just getting distance from the block to the mouse.

Each rectangle is a movie clip, if that matters.

Aucun commentaire:

Enregistrer un commentaire