CE: add parallax fill image


/ Published in: ActionScript 3
Save to your folder(s)

useful function for Citrus Engine


Copy this code and paste it in your HTML
  1. // implement in State class
  2. private function addParallaxFill(paralax:Bitmap, tmxWidth:Number, tmxHeight:Number):void {
  3. var px:Number = (paralax.width - stage.stageWidth) / (tmxWidth - stage.stageWidth);
  4. var py:Number = (paralax.height - stage.stageHeight) / (tmxHeight - stage.stageHeight);
  5. var co:CitrusSprite = new CitrusSprite("parallax", {parallaxX: px, parallaxY: py} );
  6. co.view = paralax;
  7. add(co);
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.