CoolIris type thing in 30 lines

Actionscript:
  1. package { // Piclens type thing in 30 lines (FP10+) Liam O'Donnell - spikything.com
  2.     import flash.display.Sprite;
  3.     import flash.events.Event;
  4.     public class Main extends Sprite {
  5.         private var container :Sprite;
  6.         private var imageGrid :Sprite;
  7.         private var images :Array = [];
  8.         public function Main():void {
  9.             container = addChild(new Sprite()) as Sprite;
  10.             imageGrid = container.addChild(new Sprite()) as Sprite;
  11.             for (var i:uint = 0; i <200; i++) images.push(getItem(i));
  12.             images.sortOn("z", Array.NUMERIC | Array.DESCENDING);
  13.             for each (var item:Sprite in images) imageGrid.addChild(item);
  14.             addEventListener(Event.ENTER_FRAME, update);
  15.         }
  16.         private function getItem(index:uint):Sprite {
  17.             var item:Sprite = new Sprite();
  18.             item.x = -(200 / 3) * 210 / 2 + (index / 3) * 210;
  19.             item.y = (index % 3) * 160 - 40;
  20.             item.z = 100 + Math.random() * 2000;
  21.             item.graphics.beginFill(Math.random() * 0xffffff);
  22.             item.graphics.drawRect(0, 0, 200, 150);
  23.             return item;
  24.         }
  25.         private function update(e:Event):void {
  26.             imageGrid.x += ((stage.stageWidth / 2) - mouseX) * .2;
  27.             container.rotationY = ((stage.stageWidth / 2) - mouseX) * .2;
  28.         }
  29.     }
  30. }

About Liam

Creative developer and webmaster of spikything.com
This entry was posted in 3D, AS3, Flash and tagged , , , , . Bookmark the permalink.

3 Responses to CoolIris type thing in 30 lines

  1. ahmedkl says:

    hey sorry to post here but I couldn't find a place to talk to you , wanted to ask that in which language did you develop dinky bomb?did you use flash all the way or used java also ?

    Waiting for your reply

    Regards,
    Ahmedd

  2. Liam says:

    Hi,

    Yes, it was Flash 5. Only the backend was a Java socket server - if I remember rightly :) hope that helps!

  3. ahmedkl says:

    sorry for the late reply , and thanks for your reply , i want to make a game like that , so hopefully i will start it sometimes this year :) . Another question that , which physics model did you used when it comes to the shooting?

Leave a Reply