Posted By

hejaaa on 07/27/13


Tagged

Parallax


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

majestin


CE: add parallax fill image


 / Published in: ActionScript 3
 

useful function for Citrus Engine

  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  

You need to login to post a comment.