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