Public var redLookupTable:Array = new Array() the currSprite.pixels seems to be the way to go unless I missed something.Ĭode: public dynamic class Design_1_1_Rainbow1_Codemode extends ActorScript _framePixels so I thought maybe I'd try that to see if it's why it modified both actors, but now instead it doesn't change either actor. I think that I can use the previously mentioned methods to set it for individual actors rather than modifying the "core" bitmapdata.Įdit Three: and I just realized that I was using. So long as it's single-actor effects there shouldn't be an issue, but this isn't ideal for multiple actors of the same type (or at least the same BitmapData). One very interesting side effect is that even with putting a second actor in the scene with the behavior disabled, they are both influenced by the modification of the BitmapData.
#Return actor stencyl api code
Since now I'm in code mode anyway, I can move those outside of the draw function to the init for a single run when it's created.Įdit Two: And yes, I'm certain now that was causing the lag because it's now gone and the "posterize" effect is functional and visible. It's probably all the loops for creating the arrays which is being done every time the draw function is run. Of course, my ancient laptop dropped down to 6 FPS and all the pixels of the actor (except for alpha values) went to solid black - so not quite my goal but it's doing something.
Heh, I was actually wondering if that was the issue while I was on my courier run this morning.Įdit: Yep, that did it. pixels because I had changed them to test it. At least that it's working without errors, later I'll try more things (like modifying the color arrays on the fly to get an effect more like this.Įdit: Oh, and I did use _framePixels originally, but the above code uses just.
This should sort of posterize the image according to where I stole the code from. Override public function forwardMessage(msg:String):void Public function Design_1_1_Rainbow1_Codemode(actor:Actor, scene:GameState) RedLookupTable, greenLookupTable, blueLookupTable) Var greenLookupTable:Array = new Array() Ī(,, new Point(_ActorX,_ActorY), Override public function draw(g:Graphics, x:Number, y:Number):void Override public function handleCollision(event:Collision):void Var myPoint:Point = new Point(_ActorX, _ActorY) Public dynamic class Design_1_1_Rainbow1_Codemode extends ActorScript