zaterdag 19 december 2015

Stencyl : Change the color of an actor dependent on the layer it is on

For: Stencyl
Version: 3

Random Change the color of an actor

(Update/Draw event)

      actor.clearFilters();
               _theColor = Utils.getColorRGB(Std.int(Math.random()*255), Std.int(Math.random()*255), Std.int(Math.random()*255));
               actor.setFilter([createTintFilter(_theColor, 50/100)]);


Or using Image API:

            _theActorImage = getImageForActor(actor);
               _theColor = Utils.getColorRGB(Std.int(Math.random()*255), Std.int(Math.random()*255), Std.int(Math.random()*255));
               fillImage(_theActorImage, _theColor);
               _ItemInstance = new Bitmap(_theActorImage);
               attachImageToActor(_ItemInstance, actor, Std.int(0), Std.int(0), 1);



Geen opmerkingen:

Een reactie posten