STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228130
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/51027981?noj=FRM51027981-15DC" width="1" height="1"></div>

Anima - take a role of a world creator in this fun game.swf

This is the info page for
Flash #90253

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//AdLoader (CPMStar.AdLoader) package CPMStar { import flash.events.*; import flash.display.*; import flash.system.*; import flash.net.*; public class AdLoader extends Sprite { private var cpmstarLoader:Loader; private var contentspotid:String; public function AdLoader(contentspotid:String){ super(); this.contentspotid = contentspotid; addEventListener(Event.ADDED, addedHandler); } private function dispatchHandler(event:Event):void{ dispatchEvent(event); } private function addedHandler(event:Event):void{ removeEventListener(Event.ADDED, addedHandler); Security.allowDomain("server.cpmstar.com"); var cpmstarViewSWFUrl:String = "http://server.cpmstar.com/adviewas3.swf"; var container:DisplayObjectContainer = parent; cpmstarLoader = new Loader(); cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler); cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler); cpmstarLoader.load(new URLRequest(((cpmstarViewSWFUrl + "?contentspotid=") + contentspotid))); addChild(cpmstarLoader); } } }//package CPMStar
Section 2
//qPic (Engine.qPic) package Engine { import flash.display.*; import flash.events.*; import Games.Anima.*; import flash.utils.*; public dynamic class qPic extends MovieClip { private static var _MainApp:qPic; private static var _ScreenY:Number; private static var _ScreenX:Number; private static var _ScreenHalfY:Number; public static var LastTime:Number = 0; private static var _ScreenHalfX:Number; private static var _Scene:Sprite; public static var Games:Array = new Array(); private static var _SceneBack:Sprite; public static var FrameTime:Number = 0; public function qPic(){ super(); addEventListener(Event.ENTER_FRAME, Init); } public function Init(_event:Event):void{ removeEventListener(Event.ENTER_FRAME, Init); _MainApp = (_event.target as qPic); _SceneBack = new Sprite(); _MainApp.addChild(_SceneBack); _Scene = new Sprite(); _MainApp.addChild(_Scene); _ScreenX = stage.stageWidth; _ScreenY = stage.stageHeight; _ScreenHalfX = (_ScreenX / 2); _ScreenHalfY = (_ScreenY / 2); aPicInit.Locking(); qPicKeyListener.Start(); qPicProcessor.Start(); qPicMouse.Start(); aPicInit.Start(); FocusScene(); addEventListener(Event.ENTER_FRAME, onEnterFrame); } public function onEnterFrame(_event:Event):void{ qPicProcessor.Main(); } public static function get MainApp():qPic{ return (_MainApp); } public static function get ScreenX():Number{ return (_ScreenX); } public static function get ScreenY():Number{ return (_ScreenY); } public static function UpdateTime():void{ var currTime:Number = getTimer(); FrameTime = (currTime - LastTime); LastTime = currTime; } public static function FocusScene():void{ qPic.Scene.stage.focus = qPic.Scene.stage; } public static function get ScreenHalfX():Number{ return (_ScreenHalfX); } public static function get ScreenHalfY():Number{ return (_ScreenHalfY); } public static function SiT(n:Number):Number{ return (((n * FrameTime) / 1000)); } public static function ClearScene():void{ while (qPic.Scene.numChildren > 0) { qPic.Scene.removeChildAt(0); }; } public static function get Scene():Sprite{ return (_Scene); } public static function get SceneBack():Sprite{ return (_SceneBack); } public static function ClearBackScene():void{ while (qPic.SceneBack.numChildren > 0) { qPic.SceneBack.removeChildAt(0); }; } } }//package Engine
Section 3
//qPicKeyListener (Engine.qPicKeyListener) package Engine { import flash.events.*; public class qPicKeyListener { private static var KeyPressed:Array = new Array(); private static var isCanPrintMessages:Boolean = false; private static var isKeyPressed:Array = new Array(0x0100); public function qPicKeyListener(){ super(); } public static function SetIsCanPrintMessages(val:Boolean):void{ isCanPrintMessages = val; } public static function print():void{ trace(KeyPressed); } public static function Start():void{ qPic.Scene.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); qPic.Scene.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); qPic.Scene.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseKeyDown); qPic.Scene.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseKeyUp); var i:uint; while (i < 0x0100) { isKeyPressed[i] = false; i++; }; } public static function onKeyUp(event:KeyboardEvent):void{ var i:uint; if (isKeyPressed[event.keyCode]){ isKeyPressed[event.keyCode] = false; if (isCanPrintMessages){ trace(("Key up: " + event.keyCode)); }; i = 0; while (i < KeyPressed.length) { if (KeyPressed[i] == event.keyCode){ KeyPressed.splice(i, 1); i--; }; i++; }; qPicProcessor.KeyIsUp(event.keyCode); }; } public static function IsKeyPressed(keyKode:uint):Boolean{ return (isKeyPressed[keyKode]); } public static function onKeyDown(event:KeyboardEvent):void{ if (!isKeyPressed[event.keyCode]){ isKeyPressed[event.keyCode] = true; if (isCanPrintMessages){ trace(("Key down: " + event.keyCode)); }; KeyPressed.push(event.keyCode); qPicProcessor.KeyIsDown(event.keyCode); }; } public static function onMouseKeyUp(event:MouseEvent):void{ var i:uint; var keyCode:uint = qPicKeys.LMOUSE; if (isKeyPressed[keyCode]){ isKeyPressed[keyCode] = false; if (isCanPrintMessages){ trace(("Key up: " + keyCode)); }; i = 0; while (i < KeyPressed.length) { if (KeyPressed[i] == keyCode){ KeyPressed.splice(i, 1); i--; }; i++; }; qPicProcessor.KeyIsUp(keyCode); }; } public static function ProcessingKeyPressed():void{ var i:uint; while (i < KeyPressed.length) { qPicProcessor.KeyIsStayDown(KeyPressed[i]); i++; }; } public static function onMouseKeyDown(event:MouseEvent):void{ var keyCode:uint = qPicKeys.LMOUSE; if (!isKeyPressed[keyCode]){ isKeyPressed[keyCode] = true; if (isCanPrintMessages){ trace(("Key down: " + keyCode)); }; KeyPressed.push(keyCode); qPicProcessor.KeyIsDown(keyCode); }; } } }//package Engine
Section 4
//qPicKeys (Engine.qPicKeys) package Engine { public class qPicKeys { public static const LEFT:uint = 37; public static const SUBTRACT:uint = 109; public static const MULTIPLY:uint = 106; public static const SCRLOCK:uint = 145; public static const DECIMAL:uint = 110; public static const CONTROL:uint = 17; public static const A:uint = 65; public static const B:uint = 66; public static const C:uint = 67; public static const E:uint = 69; public static const F:uint = 70; public static const G:uint = 71; public static const H:uint = 72; public static const I:uint = 73; public static const J:uint = 74; public static const D:uint = 68; public static const L:uint = 76; public static const M:uint = 77; public static const N:uint = 78; public static const O:uint = 79; public static const Q:uint = 81; public static const S:uint = 83; public static const U:uint = 85; public static const P:uint = 80; public static const R:uint = 82; public static const T:uint = 84; public static const V:uint = 86; public static const X:uint = 88; public static const Z:uint = 90; public static const K:uint = 75; public static const ESC:uint = 27; public static const SPACEBAR:uint = 32; public static const W:uint = 87; public static const Y:uint = 89; public static const BACKSPACE:uint = 8; public static const SHIFT:uint = 16; public static const TAB:uint = 9; public static const DIVIDE:uint = 111; public static const ADD:uint = 107; public static const NUMPAD0:uint = 96; public static const NUMPAD2:uint = 98; public static const NUMPAD4:uint = 100; public static const NUMPAD6:uint = 102; public static const NUMPAD1:uint = 97; public static const NUMPAD3:uint = 99; public static const NUMPAD5:uint = 101; public static const NUMPAD7:uint = 103; public static const NUMPAD9:uint = 105; public static const PAGEUP:uint = 33; public static const UP:uint = 38; public static const DOWN:uint = 40; public static const NUMPAD8:uint = 104; public static const UPER0:uint = 48; public static const UPER1:uint = 49; public static const UPER2:uint = 50; public static const UPER3:uint = 51; public static const UPER4:uint = 52; public static const UPER5:uint = 53; public static const UPER6:uint = 54; public static const UPER7:uint = 55; public static const UPER8:uint = 56; public static const UPER9:uint = 57; public static const ENTER:uint = 13; public static const LMOUSE:uint = 1; public static const END:uint = 35; public static const PAGEDOWN:uint = 34; public static const DELETE:uint = 46; public static const INSERT:uint = 45; public static const NUMLOCK:uint = 144; public static const CAPSLOCK:uint = 20; public static const PAUSE:uint = 19; public static const HOME:uint = 36; public static const RIGHT:uint = 39; public function qPicKeys(){ super(); } } }//package Engine
Section 5
//qPicLoading (Engine.qPicLoading) package Engine { import flash.display.*; public class qPicLoading { public var IsCanRunGame:Boolean;// = true public function qPicLoading(){ super(); } public function Init(MainSprite:DisplayObject):void{ } public function DeInit():void{ } public function Update(percent:Number):void{ } public function ProgressFinished():void{ } } }//package Engine
Section 6
//qPicMouse (Engine.qPicMouse) package Engine { import flash.geom.*; public class qPicMouse { public static var Position:Point; public static var Direct:Point; private static var IsInit:Boolean = false; public function qPicMouse(){ super(); } public static function Update():void{ if (!IsInit){ return; }; Direct.x = (qPic.Scene.mouseX - Position.x); Direct.y = (qPic.Scene.mouseY - Position.y); Position.x = qPic.Scene.mouseX; Position.y = qPic.Scene.mouseY; } public static function Print():void{ trace(((("Mouse - " + Position.x) + ":") + Position.y)); trace(((("MDirect - " + Direct.x) + ":") + Direct.y)); } public static function Start():void{ IsInit = true; Position = new Point(); Direct = new Point(); } } }//package Engine
Section 7
//qPicProcess (Engine.qPicProcess) package Engine { public class qPicProcess { public function qPicProcess(){ super(); } public function Init():void{ } public function DeInit():void{ } public function onKeyDown(key:uint):void{ } public function Processing():void{ } public function DeActivate():void{ } public function sendSignal(sigType:Number, sigNum:Number):void{ } public function Activate():void{ } public function onKeyStayDown(key:uint):void{ } public function onKeyUp(key:uint):void{ } } }//package Engine
Section 8
//qPicProcessor (Engine.qPicProcessor) package Engine { import flash.display.*; import flash.text.*; public class qPicProcessor { private static var IsCanRun:Boolean = false; private static var ActiveProcesses:Array; private static var LockedUrl:Array = new Array(); private static var LockedGoToUrl:Array = new Array(); private static var Processes:Array; public function qPicProcessor(){ super(); } public static function Start():void{ var tfield:TextField; var format:TextFormat; var i:uint; var ramka:Sprite; while (qPic.Scene.numChildren > 0) { qPic.Scene.removeChildAt(0); }; CheckIsCanRun(); if (IsCanRun){ ActiveProcesses = new Array(); Processes = new Array(); } else { tfield = new TextField(); tfield.autoSize = TextFieldAutoSize.LEFT; tfield.multiline = true; format = new TextFormat(); format.align = "center"; format.size = 16; tfield.defaultTextFormat = format; tfield.htmlText = "Sorry, but this game can't run here.<br>Please, visite:"; i = 0; while (i < LockedUrl.length) { tfield.htmlText = (tfield.htmlText + (((("<a target=\"_blank\" href=\"http://" + LockedGoToUrl[i]) + "\">") + LockedUrl[i]) + "</a>")); i++; }; tfield.x = ((qPic.ScreenX - tfield.textWidth) / 2); tfield.y = ((qPic.ScreenY - tfield.textHeight) / 2); ramka = new Sprite(); ramka.graphics.lineStyle(1, 0); ramka.graphics.beginFill(6399951); ramka.graphics.lineTo((tfield.textWidth + 20), 0); ramka.graphics.lineTo((tfield.textWidth + 20), (tfield.textHeight + 20)); ramka.graphics.lineTo(0, (tfield.textHeight + 20)); ramka.graphics.lineTo(0, 0); ramka.graphics.endFill(); ramka.x = ((qPic.ScreenX - ramka.width) / 2); ramka.y = ((qPic.ScreenY - ramka.height) / 2); qPic.Scene.addChild(ramka); qPic.Scene.addChild(tfield); }; } private static function DeleteFromProcesses(proc:qPicProcess):uint{ if (!IsCanRun){ return (0); }; var result:uint; var i:uint; while (i < Processes.length) { if (Processes[i] == proc){ Processes.splice(i, 1); i--; result++; }; i++; }; return (result); } public static function AddLockedUrl(url:String, gotourl:String=""):void{ LockedUrl.push(url); LockedGoToUrl.push(gotourl); IsCanRun = false; } public static function StartProcess(proc:qPicProcess):uint{ if (!IsCanRun){ return (0); }; if (DeleteFromProcesses(proc) == 0){ proc.Init(); }; Processes.push(proc); return ((Processes.length - 1)); } public static function KeyIsDown(key:uint):void{ var i:uint; if (!IsCanRun){ return; }; while (i < ActiveProcesses.length) { Processes[ActiveProcesses[i]].onKeyDown(key); i++; }; } public static function KeyIsUp(key:uint):void{ var i:uint; if (!IsCanRun){ return; }; while (i < ActiveProcesses.length) { Processes[ActiveProcesses[i]].onKeyUp(key); i++; }; } public static function GetProcess(nProc:uint):qPicProcess{ return (Processes[nProc]); } public static function DeActivateProcess(nProc:uint):void{ if (!IsCanRun){ return; }; if (nProc >= Processes.length){ return; }; if (DeleteFromActiveProcesses(nProc) != 0){ Processes[nProc].DeActivate(); }; } public static function ActivateProcess(nProc:uint):void{ if (!IsCanRun){ return; }; if (nProc >= Processes.length){ return; }; if (DeleteFromActiveProcesses(nProc) == 0){ Processes[nProc].Activate(); }; ActiveProcesses.unshift(nProc); } public static function Main():void{ if (!IsCanRun){ return; }; qPicKeyListener.ProcessingKeyPressed(); var i:uint; while (i < ActiveProcesses.length) { Processes[ActiveProcesses[i]].Processing(); i++; }; qPic.UpdateTime(); qPicMouse.Update(); } public static function KeyIsStayDown(key:uint):void{ var i:uint; if (!IsCanRun){ return; }; while (i < ActiveProcesses.length) { Processes[ActiveProcesses[i]].onKeyStayDown(key); i++; }; } public static function StopProcess(nProc:uint):void{ if (!IsCanRun){ return; }; if (nProc >= Processes.length){ return; }; DeActivateProcess(nProc); Processes[nProc].DeInit(); DeleteFromProcesses(Processes[nProc]); } private static function DeleteFromActiveProcesses(nProc:uint):uint{ if (!IsCanRun){ return (0); }; var result:uint; var i:uint; while (i < ActiveProcesses.length) { if (ActiveProcesses[i] == nProc){ ActiveProcesses.splice(i, 1); i--; result++; }; i++; }; return (result); } private static function CheckIsCanRun():void{ var i:uint; var currUrl:String = qPic.Scene.stage.loaderInfo.url.split("://")[1].split("/")[0]; if (LockedUrl.length == 0){ IsCanRun = true; } else { i = 0; while ((((i < LockedUrl.length)) && (!(IsCanRun)))) { if (LockedUrl[i] == currUrl){ IsCanRun = true; }; i++; }; }; } public static function DeleteLockedUrl(url:String):void{ var i:uint; while (i < LockedUrl.length) { if (LockedUrl[i] == url){ LockedUrl.splice(i, 1); LockedGoToUrl.splice(i, 1); i--; }; i++; }; } } }//package Engine
Section 9
//Ball (Games.Anima.GameObjects.Ball) package Games.Anima.GameObjects { import Engine.*; import flash.display.*; import flash.geom.*; public class Ball extends Sprite { public var Size:Number; public var Color:Number; public var SpeedVect:Point; public var Center:Point; public var Speed:Number; public function Ball(dx:Number, dy:Number, w:Number, col:Number){ super(); Center = new Point(dx, dy); Color = col; Size = w; Speed = 121; SpeedVect = new Point(1, 0); SpeedVect.normalize(1); GeneratePicture(); Update(); } public function Update():void{ Center.x = (Center.x + qPic.SiT((Speed * SpeedVect.x))); Center.y = (Center.y + qPic.SiT((Speed * SpeedVect.y))); if (Center.x > (qPic.ScreenX - Size)){ SpeedVect.x = -(Math.abs(SpeedVect.x)); }; if (Center.y > (qPic.ScreenY - Size)){ SpeedVect.y = -(Math.abs(SpeedVect.y)); }; if (Center.y < Size){ SpeedVect.y = Math.abs(SpeedVect.y); }; this.x = Center.x; this.y = Center.y; } public function GeneratePicture():void{ var g:Graphics = this.graphics; g.clear(); g.lineStyle(1, Color); g.beginFill(Color); g.drawCircle(0, 0, Size); g.endFill(); } public function CollisionWithTerra():void{ SpeedVect.x = Math.abs(SpeedVect.x); } } }//package Games.Anima.GameObjects
Section 10
//Home (Games.Anima.GameObjects.Home) package Games.Anima.GameObjects { import flash.display.*; public class Home extends Sprite { private var Size:Number; private var Color:Number; public function Home(col:Number, w:Number){ super(); Color = col; Size = (w / 2); GeneratePicture(); } private function GeneratePicture():void{ var g:Graphics = this.graphics; g.lineStyle(1, Color); g.beginFill(Color); g.lineTo(-(Size), 0); g.lineTo(-(Size), (-(Size) * 2)); g.lineTo(0, (-(Size) * 3)); g.lineTo(Size, (-(Size) * 2)); g.lineTo(Size, 0); g.lineTo(0, 0); g.endFill(); } } }//package Games.Anima.GameObjects
Section 11
//Human (Games.Anima.GameObjects.Human) package Games.Anima.GameObjects { import Engine.*; import flash.display.*; public class Human extends Sprite { public var WaitTime:Number;// = 0 public var Color:Number; public var Direct:Number; public var Hand2:Sprite; public var Hand1:Sprite; public var Leg2:Sprite; public var HumanHeight:Number; public var IsDead:Boolean;// = false public var Leg1:Sprite; public var Speed:Number; public var IsSleep:Boolean;// = false public var HandDirection:Number;// = 1 public var LegDirection:Number;// = 1 public var Center:Number; public static var rX:Number = 0; public function Human(col:Number, h:Number, currX){ Hand1 = new Sprite(); Hand2 = new Sprite(); Leg1 = new Sprite(); Leg2 = new Sprite(); super(); Speed = 50; Center = currX; Color = col; HumanHeight = h; GeneratePicture(); } public function IsRealDead():Boolean{ return ((y > (qPic.ScreenY + 100))); } public function GoTo(where:Number=-1):void{ if (where < 0){ if (Center > (qPic.ScreenX / 2)){ where = ((qPic.ScreenX / 2) - ((rX * 0.8) * Math.random())); } else { where = ((qPic.ScreenX / 2) + ((rX * 0.8) * Math.random())); }; }; Direct = where; } public function Update():void{ var step:Number; if (IsDead){ UpdateKilled(); return; }; if (IsSleep){ return; }; if (Direct != Center){ step = ((qPic.SiT(Speed) * (Direct - Center)) / Math.abs((Direct - Center))); Center = (Center + step); if (Center <= ((qPic.ScreenX / 2) - rX)){ Center = ((qPic.ScreenX / 2) - rX); Direct = Center; }; if (Center >= ((qPic.ScreenX / 2) + rX)){ Center = ((qPic.ScreenX / 2) + rX); Direct = Center; }; if (Leg1.rotation >= 30){ LegDirection = -1; }; if (Leg1.rotation <= 0){ LegDirection = 1; }; Leg1.rotation = (Leg1.rotation + (qPic.SiT((Speed * 1.5)) * LegDirection)); Leg2.rotation = -(Leg1.rotation); Hand1.rotation = ((Leg1.rotation * 45) / 30); Hand2.rotation = -(Hand1.rotation); if (((((((Direct - Center) <= 0)) && ((step > 0)))) || (((((Direct - Center) >= 0)) && ((step < 0)))))){ Center = Direct; Leg1.rotation = 0; Leg2.rotation = 0; Hand1.rotation = 0; Hand2.rotation = 0; LegDirection = 1; WaitTime = (1000 + (2000 * Math.random())); }; } else { WaitTime = (WaitTime - qPic.SiT(1000)); if (WaitTime <= 0){ if (Center > (qPic.ScreenX / 2)){ Direct = ((qPic.ScreenX / 2) - ((rX * 0.8) * Math.random())); } else { Direct = ((qPic.ScreenX / 2) + ((rX * 0.8) * Math.random())); }; }; }; this.x = (Center - (qPic.ScreenX / 2)); } public function UpdateKilled():void{ if (Center <= ((qPic.ScreenX / 2) - (rX * 1))){ rotation = (rotation + qPic.SiT(-360)); }; if (Center >= ((qPic.ScreenX / 2) + (rX * 1))){ rotation = (rotation + qPic.SiT(360)); }; if (Math.abs(((qPic.ScreenX / 2) - Center)) > rX){ y = (y + qPic.SiT(((Math.abs(((qPic.ScreenX / 2) - Center)) - rX) - 25))); }; var step:Number = qPic.SiT(Speed); if (Direct == 0){ step = (step * -1); }; Center = (Center + step); if (Leg1.rotation >= 45){ LegDirection = -1; }; if (Leg1.rotation <= 0){ LegDirection = 1; }; Leg1.rotation = (Leg1.rotation + (qPic.SiT((Speed * 1.5)) * LegDirection)); Leg2.rotation = -(Leg1.rotation); if (Hand1.rotation >= -125){ HandDirection = -1; }; if (Hand1.rotation <= -170){ HandDirection = 1; }; Hand1.rotation = (Hand1.rotation + (qPic.SiT((Speed * 2)) * HandDirection)); Hand2.rotation = -(Hand1.rotation); this.x = (Center - (qPic.ScreenX / 2)); } public function GeneratePicture():void{ var g:Graphics = this.graphics; g.lineStyle(1, Color); g.beginFill(Color); g.drawCircle(0, (((-(HumanHeight) * 3.5) / 4) + (HumanHeight / 2)), (HumanHeight / 8)); g.drawRoundRect((-(HumanHeight) / 16), (((-(HumanHeight) * 3) / 4) + (HumanHeight / 2)), (HumanHeight / 8), ((HumanHeight * 2) / 4), (HumanHeight / 16), (HumanHeight / 16)); g = Leg1.graphics; g.lineStyle(1, Color); g.beginFill(Color); g.drawRoundRect((-(HumanHeight) / 28), 0, (HumanHeight / 14), ((HumanHeight * 1.5) / 4), (HumanHeight / 8), (HumanHeight / 8)); g = Leg2.graphics; g.lineStyle(1, Color); g.beginFill(Color); g.drawRoundRect((-(HumanHeight) / 28), 0, (HumanHeight / 14), ((HumanHeight * 1.5) / 4), (HumanHeight / 8), (HumanHeight / 8)); g = Hand1.graphics; g.lineStyle(1, Color); g.beginFill(Color); g.drawRoundRect((-(HumanHeight) / 32), 0, (HumanHeight / 16), ((HumanHeight * 1.25) / 4), (HumanHeight / 8), (HumanHeight / 8)); g = Hand2.graphics; g.lineStyle(1, Color); g.beginFill(Color); g.drawRoundRect((-(HumanHeight) / 32), 0, (HumanHeight / 16), ((HumanHeight * 1.25) / 4), (HumanHeight / 8), (HumanHeight / 8)); Leg1.y = (((-(HumanHeight) * 1.5) / 4) + (HumanHeight / 2)); Leg1.rotation = 0; Leg2.y = (((-(HumanHeight) * 1.5) / 4) + (HumanHeight / 2)); Leg2.rotation = 0; Hand1.y = (((-(HumanHeight) * 2.8) / 4) + (HumanHeight / 2)); Hand1.rotation = 0; Hand2.y = (((-(HumanHeight) * 2.8) / 4) + (HumanHeight / 2)); Hand2.rotation = 0; this.addChild(Leg1); this.addChild(Leg2); this.addChild(Hand1); this.addChild(Hand2); Direct = 0; Update(); } public function Kill():void{ if (IsDead){ return; }; Speed = (Speed * 3); IsDead = true; Hand1.rotation = -160; if (Center <= (qPic.ScreenX / 2)){ Direct = 0; } else { Direct = qPic.ScreenX; }; } } }//package Games.Anima.GameObjects
Section 12
//Particle (Games.Anima.GameObjects.Particle) package Games.Anima.GameObjects { import Engine.*; import flash.display.*; import flash.geom.*; public class Particle extends Sprite { private var lCenter:Point; private var Color:Number; private var Speed:Number; private var Timelife:Number; private var Center:Point; private var Direction:Point; private static var CurrPos:int = -1; public static var ParticleLayer:Sprite = new Sprite(); public static var maxTimelife:Number = 5000; public static var Particles:Array = new Array(); public function Particle(_color:Number=0xFFFFFF, _speed:Number=50, angle:Number=0, pos:Point=null){ super(); Color = _color; Timelife = (maxTimelife * (0.5 + (Math.random() * 0.5))); Speed = _speed; Direction = new Point(Math.cos(angle), Math.sin(angle)); if (pos == null){ Center = new Point(); } else { Center = pos; }; lCenter = new Point(Center.x, Center.y); visible = false; GeneratePicture(); ParticleLayer.addChild(this); Particles.push(this); } public function MoreTimelife(koef:Number=1):void{ Timelife = (koef * maxTimelife); } public function SetDirection(p:Point):void{ Direction.x = p.x; Direction.y = p.y; Direction.normalize(1); } public function SetSpeed(sp:Number):void{ Speed = sp; } public function SetColor(Col:Number):void{ Color = Col; GeneratePicture(); } public function Kill():void{ Timelife = 0; Speed = 0; visible = false; } public function GetColor():Number{ return (Color); } public function GeneratePicture():void{ var g:Graphics = this.graphics; g.clear(); g.lineStyle(1, Color); g.drawCircle(0, 0, 0.5); } public function GetX():Number{ return (Center.x); } private function UpdateThis():void{ if (IsDead()){ return; }; Timelife = (Timelife - qPic.SiT(1000)); if (Speed > 0){ lCenter.x = Center.x; lCenter.y = Center.y; Center.x = (Center.x + (Direction.x * qPic.SiT(Speed))); Center.y = (Center.y + (Direction.y * qPic.SiT(Speed))); if (!visible){ if (Math.abs((Center.x - (qPic.ScreenX / 2))) < 200){ if (Math.abs((Center.y - (qPic.ScreenY / 2))) < 200){ if ((((Center.x - (qPic.ScreenX / 2)) * (Center.x - (qPic.ScreenX / 2))) + ((Center.y - (qPic.ScreenY / 2)) * (Center.y - (qPic.ScreenY / 2)))) < 40000){ visible = true; }; }; }; }; if (Center.x >= qPic.ScreenX){ Direction.x = -(Math.abs(Direction.x)); }; if (Center.x <= 0){ Direction.x = Math.abs(Direction.x); }; if (Center.y >= (qPic.ScreenY - 10)){ Speed = 0; }; if (Center.y <= 0){ Direction.y = Math.abs(Direction.y); }; this.x = Center.x; this.y = Center.y; }; if (IsDead()){ ParticleLayer.removeChild(this); }; } public function GetY():Number{ return (Center.y); } public function IsDead():Boolean{ return ((Timelife <= 0)); } public static function Update(ThisTerra:Terra):Boolean{ var res:Boolean; CurrPos = 0; while (CurrPos < Particles.length) { Particles[CurrPos].UpdateThis(); if (Particles[CurrPos].y > ThisTerra.pY){ Particles[CurrPos].Kill(); res = true; }; if (((Particles[CurrPos].IsDead()) && ((CurrPos == 0)))){ CurrPos = -1; Particles.shift(); }; CurrPos++; }; return (res); } public static function IsCollisionWith(obj:Sprite):Boolean{ var arro:Array; var arrl:Number; var arrP:Array; var i:uint; var p1:Point; var p2:Point; var min:Point; var max:Point; var a:Number; var b:Number; var c:Number; var PointY:*; var px:Number; var py:Number; if ((obj is Tree)){ arro = (obj as Tree).Nodes; arrl = arro.length; arrP = new Array(); i = 0; while (i < arrl) { arrP.push((arro[i] as TreeNode).localToGlobal(new Point())); arrP.push((arro[i] as TreeNode).localToGlobal(new Point((arro[i] as TreeNode).NodeLength))); i++; }; p1 = new Point(); p2 = new Point(); min = new Point(); max = new Point(); CurrPos = 0; while (CurrPos < Particles.length) { if (obj.hitTestPoint(Particles[CurrPos].Center.x, Particles[CurrPos].Center.y, false)){ p1 = Particles[CurrPos].Center; p2 = Particles[CurrPos].lCenter; min.y = Math.min(p1.y, p2.y); max.y = ((p1.y + p2.y) - min.y); i = 0; while (i < arrl) { if ((((Math.min(arrP[(i * 2)].x, arrP[((i * 2) + 1)].x) <= p1.x)) && ((p1.x <= Math.max(arrP[(i * 2)].x, arrP[((i * 2) + 1)].x))))){ a = (arrP[(i * 2)].y - arrP[((i * 2) + 1)].y); b = (arrP[((i * 2) + 1)].x - arrP[(i * 2)].x); c = ((arrP[(i * 2)].x * arrP[((i * 2) + 1)].y) - (arrP[((i * 2) + 1)].x * arrP[(i * 2)].y)); if (Math.abs(b) >= 0.01){ PointY = (((-(a) * p1.x) - c) / b); if ((((min.y <= PointY)) && ((PointY <= max.y)))){ Particles[CurrPos].Kill(); }; }; }; i++; }; }; CurrPos++; }; return (true); }; var res:Boolean; CurrPos = 0; while (CurrPos < Particles.length) { px = Particles[CurrPos].Center.x; py = Particles[CurrPos].Center.y; if (obj.hitTestPoint(px, py, false)){ if (obj.hitTestPoint(px, py, true)){ Particles[CurrPos].Kill(); res = true; }; }; CurrPos++; }; return (res); } } }//package Games.Anima.GameObjects
Section 13
//Terra (Games.Anima.GameObjects.Terra) package Games.Anima.GameObjects { import Engine.*; import flash.display.*; public class Terra extends Sprite { public var Color:Number; public var rX:Number; public var PositionX:Number; public var pY:Number; public var Speed:Number; public function Terra(col:Number){ super(); Color = col; GeneratePicture(); this.x = (qPic.ScreenX / 2); this.y = (qPic.ScreenY / 2); } public function SetStartSpeed(sp:Number):void{ if (sp > 0){ PositionX = -(width); } else { PositionX = (qPic.ScreenX + width); }; Speed = (((sp * 2) * y) / qPic.ScreenY); var koef:Number = (height / width); width = ((100 * y) / qPic.ScreenY); height = (koef * width); Update(); } public function Update():Boolean{ PositionX = (PositionX + qPic.SiT(Speed)); x = PositionX; if (Speed > 0){ if (PositionX > (qPic.ScreenX + width)){ return (true); }; } else { if (PositionX < -(width)){ return (true); }; }; return (false); } private function GeneratePicture():void{ var r:Number = 200; var koef:Number = 0.9; var startAlpha:Number = (-(Math.PI) * koef); var endAlpha:Number = (-(Math.PI) * (1 - koef)); rX = (r * Math.cos(endAlpha)); pY = ((qPic.ScreenY / 2) - (r * Math.sin(endAlpha))); var g:Graphics = this.graphics; g.clear(); g.lineStyle(1, Color); g.beginFill(Color); g.moveTo((r * Math.cos(endAlpha)), (-(r) * Math.sin(endAlpha))); while (startAlpha < endAlpha) { g.lineTo((r * Math.cos(startAlpha)), (-(r) * Math.sin(startAlpha))); startAlpha = (startAlpha + (Math.PI / 100)); }; g.lineTo((r * Math.cos(endAlpha)), (-(r) * Math.sin(endAlpha))); g.endFill(); } } }//package Games.Anima.GameObjects
Section 14
//Tree (Games.Anima.GameObjects.Tree) package Games.Anima.GameObjects { import flash.display.*; public class Tree extends Sprite { public var Color:Number; public var StartL:Number; public var Nodes:Array; public var CurrentGeneration:Number;// = 0 public static var maxGeneration:Number = 5; public function Tree(col:Number, l:Number){ super(); StartL = l; Color = col; Nodes = new Array(); var begin:TreeNode = new TreeNode(this, l); Nodes.push(begin); addChild(begin); } public function Wind(what:Number):void{ var n:uint; while (n < Nodes.length) { Nodes[n].rotation = (Nodes[n].rotation + what); n++; }; } public function ClearTree():void{ while (numChildren > 0) { removeChildAt(0); }; Nodes = new Array(); CurrentGeneration = 0; var begin:TreeNode = new TreeNode(this, StartL); Nodes.push(begin); addChild(begin); } public function GoNormal():void{ var n:int = (Nodes.length - 1); while (n >= 0) { (Nodes[n] as TreeNode).UpdateRotation(); n--; }; } public function SetNormalPosition():void{ var n:int = (Nodes.length - 1); while (n >= 0) { (Nodes[n] as TreeNode).SetNormalRotation(); n--; }; } public function Grow():void{ var Childs:Array; var cn:uint; var n:int = (Nodes.length - 1); var CanGoNext:Boolean; while (n >= 0) { Childs = (Nodes[n] as TreeNode).Update(); if (Childs != null){ cn = 0; while (cn < Childs.length) { Nodes.push(Childs[cn]); cn++; }; }; n--; }; } public function IsGrowed():Boolean{ var n:int = (Nodes.length - 1); while (n >= 0) { if ((Nodes[n] as TreeNode).Time < (Nodes[n] as TreeNode).maxTime){ return (false); }; n--; }; return (true); } } }//package Games.Anima.GameObjects
Section 15
//TreeNode (Games.Anima.GameObjects.TreeNode) package Games.Anima.GameObjects { import Engine.*; import flash.display.*; public class TreeNode extends Sprite { private var NodeTree:Tree; public var NodeLength:Number; private var NodeParent:TreeNode; public var Time:Number;// = 0 private var IsCanHaveChild:Boolean;// = true public var maxTime:Number; public var Generation:Number; private var NodeAlpha:Number; public static var maximalTime:Number = 8000; static var randomKoef:Number = 0.3; public static var minimalTime:Number = 5000; static var a0:Number = 5; static var a1:Number = 25; static var a2:Number = -25; static var lKoef:Number = 0.86; public function TreeNode(ThisTree:Tree, TreeLength:Number=0){ super(); NodeTree = ThisTree; NodeParent = null; NodeAlpha = -90; NodeLength = TreeLength; Generation = 0; maxTime = (minimalTime + ((maximalTime - minimalTime) * Math.random())); rotation = NodeAlpha; GeneratePicture(); } public function Update():Array{ var otn:TreeNode; if (!IsCanHaveChild){ return (null); }; if (Time < maxTime){ Time = (Time + qPic.SiT(1000)); GeneratePicture(); if (Time < maxTime){ return (null); }; }; if (Generation == Tree.maxGeneration){ return (null); }; var ResArray:Array = new Array(); var cang:Number = (a0 * ((Math.random() * 2) - 1)); var minrand:Number = 1; otn = OtherTreeNode(this, (cang + (a1 * ((((Math.random() * minrand) * randomKoef) + 1) - randomKoef))), ((NodeLength * lKoef) * ((((Math.random() * minrand) * randomKoef) + 1) - randomKoef))); ResArray.push(otn); addChild(otn); otn = OtherTreeNode(this, (cang + (a2 * ((((Math.random() * minrand) * randomKoef) + 1) - randomKoef))), ((NodeLength * lKoef) * ((((Math.random() * minrand) * randomKoef) + 1) - randomKoef))); ResArray.push(otn); addChild(otn); otn = OtherTreeNode(this, cang, (NodeLength * lKoef)); ResArray.push(otn); addChild(otn); IsCanHaveChild = false; otn = this; while (otn != null) { otn.GeneratePicture(); otn = otn.NodeParent; }; return (ResArray); } public function GeneratePicture():void{ var g:Graphics = this.graphics; g.clear(); g.lineStyle(Math.max((NodeTree.CurrentGeneration - Generation), 1), NodeTree.Color); if (Time > maxTime){ Time = maxTime; }; g.lineTo(((NodeLength * Time) / maxTime), 0); if (NodeParent != null){ x = NodeParent.NodeLength; }; } private function OtherTreeNode(ThisParent:TreeNode, ThisAlpha:Number, ThisLength:Number):TreeNode{ var res:TreeNode; res = new TreeNode(ThisParent.NodeTree); res.NodeParent = ThisParent; res.NodeAlpha = ThisAlpha; res.NodeLength = ThisLength; res.GeneratePicture(); res.Generation = (ThisParent.Generation + 1); ThisParent.NodeTree.CurrentGeneration = Math.max(ThisParent.NodeTree.CurrentGeneration, res.Generation); res.maxTime = (minimalTime + ((maximalTime - minimalTime) * Math.random())); res.rotation = ThisAlpha; return (res); } public function UpdateRotation():void{ if (rotation != NodeAlpha){ rotation = (rotation + qPic.SiT((NodeAlpha - rotation))); }; } public function IsNew():Boolean{ return (IsCanHaveChild); } public function SetNormalRotation():void{ rotation = NodeAlpha; } } }//package Games.Anima.GameObjects
Section 16
//GameLongAnimals_Sponsor (Games.Anima.sponsor.GameLongAnimals_Sponsor) package Games.Anima.sponsor { import flash.display.*; import flash.events.*; import flash.net.*; public class GameLongAnimals_Sponsor extends SimpleButton { private static const gamename:String = "anima"; public function GameLongAnimals_Sponsor(){ super(); } public function LongAnimals_Sponsor(){ } public static function MainLogoButtonPressed(e:MouseEvent){ navigateToURL(new URLRequest((("http://www.longanimalsgames.com?referral=" + gamename) + "&refmode=mainlogo")), "_blank"); } public static function MoreGamesButtonPressed(e:MouseEvent){ navigateToURL(new URLRequest((("http://www.longanimalsgames.com?referral=" + gamename) + "&refmode=moregames")), "_blank"); } public static function WalkthroughButtonPressed(e:MouseEvent){ navigateToURL(new URLRequest(("http://www.longanimalsgames.com/walkthrough.php?game=" + gamename)), "_blank"); } } }//package Games.Anima.sponsor
Section 17
//LongAnimals_Sponsor (Games.Anima.sponsor.LongAnimals_Sponsor) package Games.Anima.sponsor { import flash.events.*; import flash.display.*; import flash.net.*; public class LongAnimals_Sponsor extends SimpleButton { private static const gamename:String = "anima"; public function LongAnimals_Sponsor(){ super(); } public static function MainLogoButtonPressed(e:MouseEvent){ navigateToURL(new URLRequest((("http://www.longanimalsgames.com?referral=" + gamename) + "&refmode=mainlogo")), "_blank"); } public static function MoreGamesButtonPressed(e:MouseEvent){ navigateToURL(new URLRequest((("http://www.longanimalsgames.com?referral=" + gamename) + "&refmode=moregames")), "_blank"); } public static function WalkthroughButtonPressed(e:MouseEvent){ navigateToURL(new URLRequest(("http://www.longanimalsgames.com/walkthrough.php?game=" + gamename)), "_blank"); } } }//package Games.Anima.sponsor
Section 18
//aPicInit (Games.Anima.aPicInit) package Games.Anima { import Engine.*; import mochi.as3.*; public class aPicInit { public function aPicInit(){ super(); } public static function Start():void{ qPic.Games["Game"] = qPicProcessor.StartProcess(new Game()); qPicProcessor.ActivateProcess(qPic.Games["Game"]); } public static function Locking():void{ } } }//package Games.Anima
Section 19
//aPicLoading (Games.Anima.aPicLoading) package Games.Anima { import flash.events.*; import flash.display.*; import flash.text.*; import flash.geom.*; import Engine.*; import CPMStar.*; import Games.Anima.sponsor.*; import flash.utils.*; public class aPicLoading extends qPicLoading { public var Color:Number;// = 3818574 private var gameLogo:TextField; private var DeltaTime:Number; private var CurrentProcent:Number; private var backGround:Sprite; private var LineWidth:Number;// = 600 private var Screen:Point; private var StartedTime:Number; private var LineHeight:Number;// = 5 private var mySponsorButton:SimpleButton; private var _loadingStrip:Sprite; public var MainDO:DisplayObject; private var PlayButton:SimpleButton; private var adBox:Sprite; private var IsLoaded:Boolean; public var BgColor:Number;// = 14347502 public static var SponsorButtonOver:Class = aPicLoading_SponsorButtonOver; public static var MyEmbeddedFont:Class = aPicLoading_MyEmbeddedFont; private static var TimeWait:Number = 8000; public static var SponsorButton:Class = aPicLoading_SponsorButton; public static var SponsorButtonDown:Class = aPicLoading_SponsorButtonDown; public function aPicLoading(){ Screen = new Point(640, 480); super(); } private function SetDefaultTextLabelSetting(tf:TextField, sizef:Number):void{ tf.autoSize = TextFieldAutoSize.LEFT; tf.embedFonts = true; tf.multiline = true; tf.selectable = false; var mFont:Font = (MyEmbeddedFont as Font); var TextLabelFormat:TextFormat = new TextFormat(); TextLabelFormat.color = Color; TextLabelFormat.font = "MyFontFamily"; TextLabelFormat.size = sizef; TextLabelFormat.align = TextFormatAlign.CENTER; tf.defaultTextFormat = TextLabelFormat; } public function PressStartButton(event:MouseEvent):void{ this.IsCanRunGame = true; } private function SetTextLabelString(tf:TextField, str:String, posX:Number=-1, posY:Number=-1):void{ tf.text = str; if (((!((posX == -1))) || (!((posY == -1))))){ tf.x = (posX - (tf.width / 2)); tf.y = (posY - (tf.height / 2)); }; } override public function ProgressFinished():void{ IsLoaded = true; } override public function Update(percent:Number):void{ CurrentProcent = percent; } public function Updating(e:Event):void{ if (DeltaTime <= TimeWait){ DeltaTime = (getTimer() - StartedTime); }; if ((((DeltaTime >= TimeWait)) && (IsLoaded))){ PlayButton = CreateMenuButton("Start", 35, PressStartButton); PlayButton.x = (Screen.x / 2); PlayButton.y = (((240 + 125) + ((240 - 125) / 2)) + 15); (MainDO as Sprite).addChild(PlayButton); _loadingStrip.visible = false; (MainDO as Sprite).removeEventListener(Event.ENTER_FRAME, Updating); }; var LinePercent:Number = Math.min(CurrentProcent, (DeltaTime / TimeWait)); _loadingStrip.graphics.clear(); _loadingStrip.graphics.lineStyle(0, Color, 0); _loadingStrip.graphics.beginFill(Color); _loadingStrip.graphics.drawRect(0, 0, (LineWidth * LinePercent), LineHeight); _loadingStrip.graphics.endFill(); } override public function Init(MainSprite:DisplayObject):void{ IsLoaded = false; StartedTime = getTimer(); DeltaTime = 0; CurrentProcent = 0; MainDO = MainSprite; IsCanRunGame = false; (MainDO as Sprite).addEventListener(Event.ENTER_FRAME, Updating); backGround = new Sprite(); backGround.graphics.lineStyle(0, 0, 0); backGround.graphics.beginFill(BgColor); backGround.graphics.drawRect(0, 0, Screen.x, Screen.y); backGround.graphics.endFill(); (MainDO as Sprite).addChild(backGround); _loadingStrip = new Sprite(); _loadingStrip.graphics.lineStyle(0, 0, 0); _loadingStrip.graphics.beginFill(Color); _loadingStrip.graphics.drawRect(0, 0, 10, 5); _loadingStrip.graphics.endFill(); _loadingStrip.x = ((Screen.x - LineWidth) / 2); _loadingStrip.y = (410 - (LineHeight / 2)); (MainDO as Sprite).addChild(_loadingStrip); gameLogo = new TextField(); SetDefaultTextLabelSetting(gameLogo, 80); SetTextLabelString(gameLogo, "Anima", (Screen.x / 2), (((240 - 125) / 2) - 15)); (MainDO as Sprite).addChild(gameLogo); adBox = new AdLoader("1934QE485CFAF"); adBox.graphics.lineStyle(1, 0, 1); adBox.graphics.drawRect(0, 0, 300, 250); adBox.x = ((Screen.x / 2) - (300 / 2)); adBox.y = (((Screen.y / 2) - 30) - (250 / 2)); (MainDO as Sprite).addChild(adBox); mySponsorButton = CreateSponsorButton(LongAnimals_Sponsor.MainLogoButtonPressed); mySponsorButton.x = (Screen.x / 2); mySponsorButton.y = (((240 + 125) + ((240 - 125) / 2)) - 45); (MainDO as Sprite).addChild(mySponsorButton); } override public function DeInit():void{ (MainDO as Sprite).removeChild(mySponsorButton); (MainDO as Sprite).removeChild(adBox); (MainDO as Sprite).removeChild(backGround); (MainDO as Sprite).removeChild(gameLogo); (MainDO as Sprite).removeChild(_loadingStrip); (MainDO as Sprite).removeChild(PlayButton); } private function CreateMenuButton(str:String, sizef:Number, buttonFunct:Function=null):SimpleButton{ var tf:TextField; var sb:SimpleButton = new SimpleButton(); tf = new TextField(); SetDefaultTextLabelSetting(tf, sizef); SetTextLabelString(tf, str, 0, 0); tf.alpha = 0.25; if (buttonFunct == null){ tf.alpha = 0.25; }; sb.upState = tf; tf = new TextField(); SetDefaultTextLabelSetting(tf, sizef); SetTextLabelString(tf, str, 0, 0); if (buttonFunct == null){ tf.alpha = 0.25; }; sb.overState = tf; tf = new TextField(); SetDefaultTextLabelSetting(tf, sizef); SetTextLabelString(tf, str, 0, 0); tf.alpha = 0.75; if (buttonFunct == null){ tf.alpha = 0.25; }; sb.downState = tf; sb.hitTestState = sb.overState; if (buttonFunct != null){ sb.addEventListener(MouseEvent.CLICK, buttonFunct); }; return (sb); } private function CreateSponsorButton(buttonFunct:Function=null):SimpleButton{ var sb:SimpleButton = new SimpleButton(); var stateUper:DisplayObject = new SponsorButton(); stateUper.x = -133; stateUper.y = -41; sb.upState = stateUper; var stateOver:DisplayObject = new SponsorButtonOver(); stateOver.x = -135; stateOver.y = -45; sb.overState = stateOver; var stateDown:DisplayObject = new SponsorButtonDown(); stateDown.x = -135; stateDown.y = -45; sb.downState = stateDown; sb.hitTestState = sb.overState; if (buttonFunct != null){ sb.addEventListener(MouseEvent.CLICK, buttonFunct); }; return (sb); } } }//package Games.Anima
Section 20
//aPicLoading_MyEmbeddedFont (Games.Anima.aPicLoading_MyEmbeddedFont) package Games.Anima { import mx.core.*; public class aPicLoading_MyEmbeddedFont extends FontAsset { } }//package Games.Anima
Section 21
//aPicLoading_SponsorButton (Games.Anima.aPicLoading_SponsorButton) package Games.Anima { import mx.core.*; public class aPicLoading_SponsorButton extends BitmapAsset { } }//package Games.Anima
Section 22
//aPicLoading_SponsorButtonDown (Games.Anima.aPicLoading_SponsorButtonDown) package Games.Anima { import mx.core.*; public class aPicLoading_SponsorButtonDown extends BitmapAsset { } }//package Games.Anima
Section 23
//aPicLoading_SponsorButtonOver (Games.Anima.aPicLoading_SponsorButtonOver) package Games.Anima { import mx.core.*; public class aPicLoading_SponsorButtonOver extends BitmapAsset { } }//package Games.Anima
Section 24
//Game (Games.Anima.Game) package Games.Anima { import Engine.*; import flash.display.*; import flash.events.*; import flash.text.*; import Games.Anima.GameObjects.*; import flash.geom.*; import flash.media.*; import Games.Anima.sponsor.*; public class Game extends qPicProcess { public var RestartButton:SimpleButton; public var TreeSegmentTimeMax:Number;// = 1000 public var SplashScreenMaxTime:Number;// = 3000 public var LongAnimalsLogo:SimpleButton; public var TimeLabel:TextField; public var PlayOtherGameButton:SimpleButton; public var InGamePlayMoreGames:SimpleButton; public var TreeSegmentTimeMaxE5:Number;// = 1000 public var StartButton:SimpleButton; public var TimeRain:Number;// = 0 public var GameSoundChannel:SoundChannel; public var OtherWorlds:Array; public var SplashScreenTime:Number;// = 0 public var Color:Number;// = 3818574 public var EpisodeTime:Number; public var TaskLabel:TextField; public var RainChannel1:SoundChannel; public var PlayMoreGames:SimpleButton; public var MousesTime:Number; public var ThisTree:Tree; public var TreeSegmentTimeMinE5:Number;// = 800 public var MaxEpisodeTime:Number;// = 3000 public var CopyRight:TextField; public var MousesDirection:Number; public var TheHumans:Array; public var FPSLabel:TextField; public var RainChannel:SoundChannel; public var RainSound:Number;// = 0.1 public var ThisHome:Home; public var ThisTreeHeight:Number;// = 60 public var TheTrees:Array; public var NextLevelButton:SimpleButton; public var MuteButton:SimpleButton; public var SplashScreen:Sprite; public var Logo:TextField; public var Episode:Number; public var ThisBall:Ball; public var Help1:TextField; public var Help2:TextField; public var ThisTerra:Terra; public var TreeSegmentTimeMin:Number;// = 800 public var IsNotEnd:Boolean; public var GameEndSoundChannel:SoundChannel; public var BgColor:Number;// = 14347502 public function Game(){ OtherWorlds = new Array(); SplashScreen = new Sprite(); FPSLabel = new TextField(); TimeLabel = new TextField(); TaskLabel = new TextField(); Help1 = new TextField(); Help2 = new TextField(); Logo = new TextField(); super(); } override public function Activate():void{ IsNotEnd = true; Episode = 0; EpisodeTime = MaxEpisodeTime; RainChannel = null; RainChannel1 = null; GameSoundChannel = null; GameEndSoundChannel = null; ThisBall = null; MousesTime = 500; MousesDirection = -1; LongAnimalsLogo = CreateSponsorButton(GameLongAnimals_Sponsor.MainLogoButtonPressed); LongAnimalsLogo.x = qPic.ScreenHalfX; LongAnimalsLogo.y = ((qPic.ScreenY * 3) / 4); CopyRight = new TextField(); SetDefaultTextLabelSetting(CopyRight, 12, Color); SetTextLabelString(CopyRight, "Created by 4mlr", qPic.ScreenHalfX, ((qPic.ScreenY * 7) / 8)); InGamePlayMoreGames = CreateSimpleButton("Other games", 15, Color, ClickMoreGamesButton); InGamePlayMoreGames.x = ((qPic.ScreenX - (InGamePlayMoreGames.width / 2)) - 10); InGamePlayMoreGames.y = ((InGamePlayMoreGames.height / 2) + 10); RestartButton = CreateSimpleButton("Restart", 15, Color, ClickRestartButton); RestartButton.x = ((qPic.ScreenX - (RestartButton.width / 2)) - 10); RestartButton.y = (((RestartButton.height / 2) + 10) + InGamePlayMoreGames.height); NextLevelButton = CreateSimpleButton("Next episode", 15, Color, ClickNextLevelButton); NextLevelButton.x = ((qPic.ScreenX - (NextLevelButton.width / 2)) - 10); NextLevelButton.y = (((NextLevelButton.height / 2) + 10) + InGamePlayMoreGames.height); MuteButton = CreateSimpleButton("Music", 15, Color, ClickMuteButton); MuteButton.x = ((MuteButton.width / 2) + 10); MuteButton.y = ((MuteButton.height / 2) + 10); StartButton = CreateSimpleButton("Play", 20, Color, ClickStartButton); PlayMoreGames = CreateSimpleButton("More games", 20, Color, ClickMoreGamesButton); qPic.ClearScene(); var back:Sprite = new Sprite(); var g:Graphics = back.graphics; g.lineStyle(1, 0, 0); g.beginFill(BgColor); g.drawRect(0, 0, qPic.ScreenX, qPic.ScreenY); g.endFill(); qPic.Scene.addChild(back); var i:uint; while (i < Particle.Particles.length) { Particle.Particles[i].Kill(); i++; }; Particle.Update(ThisTerra); qPic.Scene.addChild(Particle.ParticleLayer); qPic.Scene.addChild(ThisTerra); qPic.Scene.addChild(TaskLabel); qPic.Scene.addChild(Help1); qPic.Scene.addChild(Help2); qPic.Scene.addChild(Logo); qPic.Scene.addChild(LongAnimalsLogo); qPic.Scene.addChild(CopyRight); qPic.Scene.addChild(RestartButton); qPic.Scene.addChild(NextLevelButton); qPic.Scene.addChild(InGamePlayMoreGames); qPic.Scene.addChild(MuteButton); qPic.Scene.addChild(StartButton); qPic.Scene.addChild(PlayMoreGames); ThisTerra.addChild(ThisTree); ThisTerra.addChild(TimeLabel); SetDefaultTextLabelSetting(Logo, 100, Color); Logo.text = "Anima"; Logo.x = ((qPic.ScreenX / 2) - (Logo.width / 2)); Logo.y = ((qPic.ScreenY / 2) - ((Logo.height * 3) / 4)); SetDefaultTextLabelSetting(Help1, 15, Color); SetTextLabelString(Help1, "Space - next episode", (qPic.ScreenX / 2), 50); Help1.y = (Logo.y + Logo.height); SetDefaultTextLabelSetting(Help2, 15, Color); SetTextLabelString(Help2, "You can use only\nleft and right arrows", ((qPic.ScreenX / 2) + 100), (qPic.ScreenY / 2)); StartButton.x = (Logo.x + (StartButton.width / 2)); StartButton.y = (Logo.y + Logo.height); PlayMoreGames.x = ((Logo.x + Logo.width) - (PlayMoreGames.width / 2)); PlayMoreGames.y = (Logo.y + Logo.height); } private function SetTextLabelString(tf:TextField, str:String, posX:Number=-1, posY:Number=-1):void{ tf.text = str; if (((!((posX == -1))) || (!((posY == -1))))){ tf.x = (posX - (tf.width / 2)); tf.y = (posY - (tf.height / 2)); }; } override public function Init():void{ MochiBot.track(qPic.MainApp, "626c52f7"); TreeNode.minimalTime = TreeSegmentTimeMin; TreeNode.maximalTime = TreeSegmentTimeMax; ThisTerra = new Terra(Color); Human.rX = ThisTerra.rX; ThisTree = new Tree(Color, ThisTreeHeight); ThisTree.x = 0; ThisTree.y = (ThisTerra.pY - (qPic.ScreenY / 2)); ThisHome = new Home(Color, 30); ThisHome.x = ((qPic.ScreenX / 2) + (ThisTerra.rX - 50)); ThisHome.y = ThisTerra.pY; TheHumans = new Array(); var g:Graphics = SplashScreen.graphics; g.lineStyle(1, 0, 0); g.beginFill(BgColor); g.drawRect(0, 0, qPic.ScreenX, qPic.ScreenY); g.endFill(); SplashScreen.alpha = 0; } public function ClickMuteButton(event:MouseEvent):void{ trace("Mute"); var soundtran:SoundTransform = SoundMixer.soundTransform; soundtran.volume = (1 - soundtran.volume); SoundMixer.soundTransform = soundtran; } public function ClickMoreGamesButton(event:MouseEvent):void{ trace("New window"); GameLongAnimals_Sponsor.MoreGamesButtonPressed(event); } private function CreateSponsorButton(buttonFunct:Function=null):SimpleButton{ var sb:SimpleButton = new SimpleButton(); var stateUper:DisplayObject = new Res.SponsorButton(); stateUper.x = -133; stateUper.y = -41; sb.upState = stateUper; var stateOver:DisplayObject = new Res.SponsorButtonOver(); stateOver.x = -135; stateOver.y = -45; sb.overState = stateOver; var stateDown:DisplayObject = new Res.SponsorButtonDown(); stateDown.x = -135; stateDown.y = -45; sb.downState = stateDown; sb.hitTestState = sb.overState; if (buttonFunct != null){ sb.addEventListener(MouseEvent.CLICK, buttonFunct); }; return (sb); } override public function Processing():void{ var i:uint; var addNew:Boolean; var ThisHuman:Human; var IsNeedAddNewHuman:Boolean; var lh:Number; var WorldX:Number; var ty1:Number; var ty2:Number; var speeder:Number; var koef:Number; if (SplashScreenTime > 0){ SplashScreen.alpha = ((SplashScreenTime * 2) / SplashScreenMaxTime); SplashScreenTime = (SplashScreenTime - qPic.SiT(1000)); return; }; if (SplashScreen.parent == qPic.Scene){ qPic.Scene.removeChild(SplashScreen); }; if (!IsNotEnd){ EpisodeTime = MaxEpisodeTime; }; if (((IsNotEnd) && ((EpisodeTime < MaxEpisodeTime)))){ EpisodeTime = (EpisodeTime + qPic.SiT(100)); if ((((EpisodeTime >= MaxEpisodeTime)) && ((Episode == 1)))){ IsNotEnd = false; }; if ((((EpisodeTime >= MaxEpisodeTime)) && ((Episode == 5)))){ IsNotEnd = false; }; }; var str:String = ""; if (EpisodeTime >= MaxEpisodeTime){ str = ("Episode " + (Episode + 1)); if (Episode == 5){ str = ""; }; if (!IsNotEnd){ str = "The end"; }; SetDefaultTextLabelSetting(TimeLabel, 50, BgColor); } else { str = Math.ceil(((MaxEpisodeTime - EpisodeTime) / 100)).toString(); }; SetTextLabelString(TimeLabel, str, 0, ((180 + (ThisTerra.pY - (qPic.ScreenY / 2))) / 2)); var TaskStr:String = ""; if (EpisodeTime < MaxEpisodeTime){ if (Episode == 1){ TaskStr = "Grow."; }; if (Episode == 2){ TaskStr = "Protect as many people as possible."; }; if (Episode == 3){ TaskStr = "Save only 2 people."; }; if (Episode == 4){ TaskStr = "Don't kill them."; }; if (Episode == 5){ TaskStr = "Create happy world."; }; } else { if (Episode == 0){ Help1.x = ((qPic.ScreenX / 2) - (Help1.width / 2)); }; if (Episode == 1){ Help1.x = (((qPic.ScreenX / 2) - 50) - Help1.width); }; if ((((Episode == 5)) && (IsNotEnd))){ TaskStr = "Congratulations!"; }; }; if (TaskStr != ""){ SetDefaultTextLabelSetting(TaskLabel, 17, Color); }; SetTextLabelString(TaskLabel, TaskStr, (qPic.ScreenX / 2), 20); Help1.visible = (((((Episode == 1)) && ((EpisodeTime >= MaxEpisodeTime)))) && (IsNotEnd)); Help2.visible = (((Episode == 1)) && ((EpisodeTime < MaxEpisodeTime))); ThisTerra.alpha = 1; if ((((Episode == 1)) && ((Logo.alpha > 0)))){ ThisTerra.alpha = Math.min(1, (EpisodeTime / 100)); Logo.alpha = Math.max(0, (1 - (EpisodeTime / 200))); if (GameSoundChannel == null){ GameSoundChannel = new Res.GameSound().play(0, int.MAX_VALUE, new SoundTransform(1)); }; }; MuteButton.visible = (Episode > 0); InGamePlayMoreGames.visible = (Episode > 0); if ((((((Episode == 5)) && ((EpisodeTime >= MaxEpisodeTime)))) && (IsNotEnd))){ InGamePlayMoreGames.visible = false; }; RestartButton.visible = !(IsNotEnd); NextLevelButton.visible = (((((((EpisodeTime >= MaxEpisodeTime)) && (IsNotEnd))) && ((Episode > 0)))) && ((Episode < 5))); StartButton.visible = (((Episode == 0)) && (StartButton.visible)); PlayMoreGames.visible = (((Episode == 0)) && (PlayMoreGames.visible)); LongAnimalsLogo.visible = (((Episode == 0)) && (LongAnimalsLogo.visible)); if (LongAnimalsLogo.visible){ ThisTerra.alpha = 0; Logo.alpha = 1; }; if ((((((((Episode == 5)) && ((EpisodeTime >= MaxEpisodeTime)))) && (IsNotEnd))) && (!((PlayOtherGameButton == null))))){ LongAnimalsLogo.visible = true; }; CopyRight.visible = LongAnimalsLogo.visible; if (Episode == 1){ MousesTime = (MousesTime + (MousesDirection * qPic.SiT(1000))); if (MousesTime < -500){ MousesTime = -500; }; if (MousesTime > 500){ MousesTime = 500; }; if ((((Math.abs(MousesTime) < 250)) && ((EpisodeTime < MaxEpisodeTime)))){ ThisTree.Grow(); }; if (ThisTree.IsGrowed()){ EpisodeTime = MaxEpisodeTime; }; } else { if (Episode == 2){ if ((((RainChannel == null)) && ((EpisodeTime < MaxEpisodeTime)))){ RainChannel = new Res.RainSound().play(0, int.MAX_VALUE, new SoundTransform(RainSound)); RainChannel1 = new Res.RainSound().play(2000, int.MAX_VALUE, new SoundTransform(RainSound)); }; if (((((!((RainChannel == null))) && ((EpisodeTime >= MaxEpisodeTime)))) && (IsNotEnd))){ RainChannel.stop(); RainChannel1.stop(); RainChannel = null; }; ThisTree.GoNormal(); i = 0; while (i < TheHumans.length) { if (TheHumans[i] != null){ TheHumans[i].Update(); }; i++; }; if ((((EpisodeTime >= MaxEpisodeTime)) && (IsNotEnd))){ i = 0; while (i < Particle.Particles.length) { Particle.Particles[i].Kill(); i++; }; return; }; TimeRain = (TimeRain + qPic.SiT(1000)); while (TimeRain > 100) { TimeRain = (TimeRain - 100); i = 0; while (i < 4) { new Particle(Color, 150, (Math.PI / 2), new Point(((qPic.ScreenX / 2) + (ThisTerra.rX * ((Math.random() * 2) - 1))), (-50 * Math.random()))); i++; }; }; Particle.Update(ThisTerra); Particle.IsCollisionWith(ThisTree); i = 0; while (i < TheHumans.length) { if (((!((TheHumans[i] == null))) && (Particle.IsCollisionWith(TheHumans[i])))){ TheHumans[i].Kill(); }; i++; }; i = 0; while (i < TheHumans.length) { if (((!((TheHumans[i] == null))) && (TheHumans[i].IsRealDead()))){ ThisTerra.removeChild(TheHumans[i]); TheHumans[i] = null; }; i++; }; addNew = true; i = 0; while (i < TheHumans.length) { if (TheHumans[i] != null){ addNew = false; }; i++; }; if (TheHumans.length >= 4){ if (addNew){ IsNotEnd = false; }; addNew = false; }; i = 0; while ((((i < 2)) && (addNew))) { ThisHuman = new Human(Color, 25, (((qPic.ScreenX / 2) - 20) + (40 * i))); ThisHuman.y = ((ThisTerra.pY - (ThisHuman.HumanHeight / 2)) - (qPic.ScreenY / 2)); ThisHuman.GoTo((((qPic.ScreenX / 2) + 20) - (40 * i))); ThisTerra.addChild(ThisHuman); TheHumans.push(ThisHuman); i++; }; } else { if (Episode == 3){ if (RainChannel != null){ RainChannel.stop(); RainChannel1.stop(); RainChannel = null; }; Particle.Update(ThisTerra); ThisTree.GoNormal(); i = 0; while (i < TheHumans.length) { if (TheHumans[i] != null){ TheHumans[i].Update(); }; i++; }; if (ThisTree.parent == ThisTerra){ lh = ThisTree.height; ThisTree.height = (ThisTree.height - qPic.SiT(50)); ThisTree.width = (ThisTree.width - qPic.SiT(((50 * ThisTree.width) / ThisTree.height))); if ((((ThisTree.height <= 1)) || ((ThisTree.height == lh)))){ while (ThisTerra.numChildren > 0) { ThisTerra.removeChildAt(0); }; ThisTerra.addChild(TimeLabel); TheHumans = new Array(); }; EpisodeTime = 0; }; if (EpisodeTime == 0){ return; }; IsNeedAddNewHuman = true; if (((!((TheHumans[0] == null))) && ((TheHumans[0].parent == qPic.Scene)))){ IsNeedAddNewHuman = false; TheHumans[0].y = (TheHumans[0].y + qPic.SiT(350)); if (TheHumans[0].y > (qPic.ScreenY + 25)){ qPic.Scene.removeChild(TheHumans[0]); TheHumans[0] = null; IsNeedAddNewHuman = true; }; }; if (((IsNeedAddNewHuman) && ((EpisodeTime < MaxEpisodeTime)))){ ThisHuman = new Human(Color, 25, (qPic.ScreenX / 2)); ThisHuman.x = ((qPic.ScreenX / 2) + (200 * ((Math.random() * 2) - 1))); ThisHuman.y = -25; ThisHuman.IsSleep = true; qPic.Scene.addChild(ThisHuman); TheHumans[0] = ThisHuman; }; if (TheHumans[0] != null){ if (((((ThisTerra.hitTestPoint(TheHumans[0].x, (TheHumans[0].y + (TheHumans[0].height / 2)), true)) || (ThisTerra.hitTestPoint(TheHumans[0].x, TheHumans[0].y, true)))) || (ThisTerra.hitTestPoint(TheHumans[0].x, (TheHumans[0].y - (TheHumans[0].height / 2)), true)))){ ThisHuman = (TheHumans[0] as Human); qPic.Scene.removeChild(ThisHuman); ThisHuman.x = 0; ThisHuman.y = ((ThisTerra.pY - (qPic.ScreenY / 2)) - (ThisHuman.height / 2)); ThisHuman.IsSleep = false; ThisTerra.addChild(ThisHuman); TheHumans.push(ThisHuman); TheHumans[0] = null; }; }; i = 1; while (i < TheHumans.length) { if (TheHumans[i] != null){ TheHumans[i].Update(); }; i++; }; if (TheHumans.length > 3){ IsNotEnd = false; }; if ((((EpisodeTime >= MaxEpisodeTime)) && ((TheHumans.length < 3)))){ IsNotEnd = false; }; } else { if (Episode == 4){ i = 1; while (i < TheHumans.length) { if (TheHumans[i] != null){ TheHumans[i].Update(); while (Math.abs(((qPic.ScreenX / 2) - TheHumans[i].Direct)) < 20) { TheHumans[i].GoTo(); }; }; i++; }; if (ThisTerra.rotation != 90){ if (TheHumans[0] != null){ qPic.Scene.removeChild(TheHumans[0]); TheHumans[0] = null; }; speeder = 90; if (Math.abs((ThisTerra.rotation - 90)) < 10){ speeder = 30; }; if ((((ThisTerra.rotation < 90)) && ((ThisTerra.rotation > -90)))){ ThisTerra.rotation = (ThisTerra.rotation + qPic.SiT(speeder)); } else { ThisTerra.rotation = (ThisTerra.rotation - qPic.SiT(speeder)); }; if (Math.abs((ThisTerra.rotation - 90)) < 1){ ThisTerra.rotation = 90; }; EpisodeTime = 0; }; if (EpisodeTime == 0){ return; }; if (ThisBall == null){ ThisBall = new Ball(((qPic.ScreenX * 3) / 4), (qPic.ScreenY / 2), 15, Color); if (EpisodeTime < MaxEpisodeTime){ qPic.Scene.addChild(ThisBall); }; } else { if (EpisodeTime < MaxEpisodeTime){ ThisBall.Update(); }; }; WorldX = (ThisTerra.x - (ThisTerra.pY - (qPic.ScreenY / 2))); if (IsNotEnd){ if ((ThisBall.Center.x - ThisBall.Size) <= WorldX){ if (ThisBall.Center.x > WorldX){ ThisBall.CollisionWithTerra(); }; if ((ThisBall.Center.x - WorldX) < ThisBall.Size){ ThisBall.Center.x = (WorldX + ThisBall.Size); ThisBall.x = ThisBall.Center.x; }; }; }; if (ThisTerra.hitTestPoint((ThisBall.Center.x + ThisBall.Size), ThisBall.Center.y, true)){ IsNotEnd = false; }; WorldX = (WorldX + TheHumans[1].height); ty1 = ((qPic.ScreenY / 2) + TheHumans[1].x); ty2 = ((qPic.ScreenY / 2) + TheHumans[2].x); if ((((EpisodeTime < MaxEpisodeTime)) && (((ThisBall.hitTestPoint(WorldX, ty1, true)) || (ThisBall.hitTestPoint(WorldX, ty2, true)))))){ TheHumans[1].Kill(); TheHumans[2].Kill(); IsNotEnd = false; }; if (((!(IsNotEnd)) && ((ThisBall.parent == qPic.Scene)))){ qPic.Scene.removeChild(ThisBall); IsNotEnd = false; }; } else { if (Episode == 5){ if ((((EpisodeTime >= MaxEpisodeTime)) && (IsNotEnd))){ if (RainChannel != null){ RainChannel.stop(); RainChannel1.stop(); RainChannel = null; }; if (ThisTerra.width > 50){ koef = (ThisTerra.height / ThisTerra.width); ThisTerra.width = (ThisTerra.width - qPic.SiT(50)); ThisTerra.height = (koef * ThisTerra.width); } else { if (PlayOtherGameButton == null){ MochiBot.track(qPic.MainApp, "d5ac62bb"); PlayOtherGameButton = CreateSimpleButton("Play other game!", 15, Color, ClickMoreGamesButton); PlayOtherGameButton.y = (qPic.ScreenY / 2); PlayOtherGameButton.x = (((qPic.ScreenX / 2) + 50) + (PlayOtherGameButton.width / 2)); qPic.Scene.addChild(PlayOtherGameButton); Logo = new TextField(); SetDefaultTextLabelSetting(Logo, 35, Color); SetTextLabelString(Logo, "Anima", 0, (qPic.ScreenY / 2)); Logo.x = ((ThisTerra.x - 40) - Logo.width); qPic.Scene.addChild(Logo); TaskLabel.visible = false; }; }; }; if ((((RainChannel == null)) && ((EpisodeTime < MaxEpisodeTime)))){ RainChannel = new Res.RainSound().play(0, int.MAX_VALUE, new SoundTransform(RainSound)); RainChannel1 = new Res.RainSound().play(2000, int.MAX_VALUE, new SoundTransform(RainSound)); }; if ((((((EpisodeTime >= MaxEpisodeTime)) && (IsNotEnd))) && ((GameEndSoundChannel == null)))){ GameEndSoundChannel = new Res.GameEndSound().play(0, 1, new SoundTransform(1)); }; i = 1; while (i < TheHumans.length) { if (TheHumans[i] != null){ TheHumans[i].Update(); }; i++; }; if (ThisTerra.rotation != 0){ if (ThisBall != null){ if (ThisBall.parent == qPic.Scene){ qPic.Scene.removeChild(ThisBall); }; ThisBall = null; }; speeder = 90; ThisTerra.rotation = (ThisTerra.rotation - qPic.SiT(speeder)); if (ThisTerra.rotation < 0){ ThisTerra.rotation = 0; }; EpisodeTime = 0; }; if (ThisTerra.x != (qPic.ScreenX / 2)){ speeder = 100; if (Math.abs((ThisTerra.x - (qPic.ScreenX / 2))) < 10){ speeder = 30; }; if (ThisTerra.x < (qPic.ScreenX / 2)){ ThisTerra.x = (ThisTerra.x + qPic.SiT(speeder)); } else { ThisTerra.x = (ThisTerra.x - qPic.SiT(speeder)); }; if (Math.abs((ThisTerra.x - (qPic.ScreenX / 2))) < 1){ ThisTerra.x = (qPic.ScreenX / 2); }; EpisodeTime = 0; }; if (EpisodeTime == 0){ return; }; if (ThisTree != null){ ThisTree = null; TheTrees = new Array(); TreeNode.minimalTime = TreeSegmentTimeMinE5; TreeNode.maximalTime = TreeSegmentTimeMaxE5; TheTrees.push(new Tree(Color, 60)); TheTrees.push(new Tree(Color, 60)); i = 0; while (i < TheTrees.length) { TheTrees[i].y = (ThisTerra.pY - (qPic.ScreenY / 2)); TheTrees[i].x = ((-(ThisTerra.rX) / 2) + (ThisTerra.rX * i)); ThisTerra.addChild(TheTrees[i]); i++; }; }; if (EpisodeTime < MaxEpisodeTime){ i = 0; while (i < TheTrees.length) { if ((((Math.abs((TheTrees[i].x - TheHumans[1].x)) < 20)) || ((EpisodeTime < 200)))){ TheTrees[i].Grow(); }; i++; }; }; if (((TheTrees[0].IsGrowed()) && (TheTrees[1].IsGrowed()))){ EpisodeTime = MaxEpisodeTime; } else { if (EpisodeTime >= MaxEpisodeTime){ IsNotEnd = false; }; }; if ((((EpisodeTime >= MaxEpisodeTime)) && (IsNotEnd))){ if (Particle.Particles.length > 0){ i = 0; while (i < Particle.Particles.length) { Particle.Particles[i].Kill(); i++; }; }; return; }; Particle.Update(ThisTerra); TimeRain = (TimeRain + qPic.SiT(1000)); while (TimeRain > 500) { TimeRain = (TimeRain - 500); i = 0; while (i < 10) { new Particle(Color, 150, (Math.PI / 2), new Point(((qPic.ScreenX / 2) + (ThisTerra.rX * ((Math.random() * 2) - 1))), (-50 * Math.random()))); i++; }; }; }; }; }; }; }; FPSLabel.text = ("FPS: " + (Math.floor(((1000 * 100) / qPic.FrameTime)) / 100)); } public function RestoreLevel1():void{ ThisTree.ClearTree(); MousesTime = 500; MousesDirection = -1; } public function RestoreLevel2():void{ var i:uint; if (RainChannel != null){ RainChannel.stop(); RainChannel1.stop(); RainChannel = null; }; i = 0; while (i < Particle.Particles.length) { Particle.Particles[i].Kill(); i++; }; i = 0; while (i < TheHumans.length) { if (((!((TheHumans[i] == null))) && ((TheHumans[i].parent == ThisTerra)))){ ThisTerra.removeChild(TheHumans[i]); }; i++; }; TheHumans = new Array(); ThisTree.SetNormalPosition(); } public function RestoreLevel3():void{ ThisTerra.rotation = 0; var i:uint; while (i < TheHumans.length) { if (((!((TheHumans[i] == null))) && ((TheHumans[i].parent == ThisTerra)))){ ThisTerra.removeChild(TheHumans[i]); }; i++; }; TheHumans = new Array(); } public function RestoreLevel4():void{ var ThisHuman:Human; if (ThisBall != null){ if (ThisBall.parent == qPic.Scene){ qPic.Scene.removeChild(ThisBall); }; ThisBall = null; }; var i:uint; while (i < TheHumans.length) { if (((!((TheHumans[i] == null))) && ((TheHumans[i].parent == ThisTerra)))){ ThisTerra.removeChild(TheHumans[i]); }; i++; }; TheHumans = new Array(); TheHumans[0] = null; ThisHuman = new Human(Color, 25, (qPic.ScreenX / 2)); ThisHuman.x = 0; ThisHuman.y = ((ThisTerra.pY - (qPic.ScreenY / 2)) - (ThisHuman.height / 2)); ThisTerra.addChild(ThisHuman); ThisHuman.GoTo((qPic.ScreenX * Math.random())); TheHumans[1] = ThisHuman; ThisHuman = new Human(Color, 25, (qPic.ScreenX / 2)); ThisHuman.x = 0; ThisHuman.y = ((ThisTerra.pY - (qPic.ScreenY / 2)) - (ThisHuman.height / 2)); ThisTerra.addChild(ThisHuman); ThisHuman.GoTo((qPic.ScreenX * Math.random())); TheHumans[2] = ThisHuman; ThisTerra.x = (qPic.ScreenX / 2); } public function RestoreLevel5():void{ var i:uint; if (RainChannel != null){ RainChannel.stop(); RainChannel1.stop(); RainChannel = null; }; i = 0; while (i < TheTrees.length) { (TheTrees[i] as Tree).ClearTree(); i++; }; i = 0; while (i < Particle.Particles.length) { Particle.Particles[i].Kill(); i++; }; ThisTerra.rotation = 90; } private function SetDefaultTextLabelSetting(tf:TextField, sizef:Number, col:Number):void{ tf.autoSize = TextFieldAutoSize.LEFT; tf.embedFonts = true; tf.multiline = true; tf.selectable = false; var mFont:Font = (Res.MyEmbeddedFont as Font); var TextLabelFormat:TextFormat = new TextFormat(); TextLabelFormat.color = col; TextLabelFormat.font = "MyFontFamily"; TextLabelFormat.size = sizef; TextLabelFormat.align = TextFormatAlign.CENTER; tf.defaultTextFormat = TextLabelFormat; } public function ClickNextLevelButton(event:MouseEvent):void{ var i:uint; trace("Next episode"); if (((((IsNotEnd) && ((EpisodeTime >= MaxEpisodeTime)))) && ((Episode < 5)))){ if (Episode == 2){ i = 0; while (i < TheHumans.length) { if (TheHumans[i] != null){ TheHumans[i].Kill(); }; i++; }; }; EpisodeTime = 0; Episode++; SetDefaultTextLabelSetting(TimeLabel, 80, BgColor); }; if (!IsNotEnd){ ClickRestartButton(event); }; } public function ClickRestartButton(event:MouseEvent):void{ trace("Restart"); if (Episode == 1){ RestoreLevel1(); }; if (Episode == 2){ RestoreLevel2(); }; if (Episode == 3){ RestoreLevel3(); }; if (Episode == 4){ RestoreLevel4(); }; if (Episode == 5){ RestoreLevel5(); }; IsNotEnd = true; Episode--; EpisodeTime = MaxEpisodeTime; Processing(); qPic.Scene.addChild(SplashScreen); SplashScreenTime = SplashScreenMaxTime; qPic.FocusScene(); ClickNextLevelButton(null); } public function ClickStartButton(event:MouseEvent):void{ trace("Start"); ClickNextLevelButton(event); } private function CreateSimpleButton(str:String, sizef:Number, col:Number, buttonFunct:Function=null):SimpleButton{ var tf:TextField; var alphamin:Number = 0.5; var sb:SimpleButton = new SimpleButton(); tf = new TextField(); SetDefaultTextLabelSetting(tf, sizef, col); SetTextLabelString(tf, str, 0, 0); tf.alpha = alphamin; if (buttonFunct == null){ tf.alpha = alphamin; }; sb.upState = tf; tf = new TextField(); SetDefaultTextLabelSetting(tf, sizef, col); SetTextLabelString(tf, str, 0, 0); if (buttonFunct == null){ tf.alpha = alphamin; }; sb.overState = tf; tf = new TextField(); SetDefaultTextLabelSetting(tf, sizef, col); SetTextLabelString(tf, str, 0, 0); tf.alpha = 0.75; if (buttonFunct == null){ tf.alpha = alphamin; }; sb.downState = tf; sb.hitTestState = sb.overState; if (buttonFunct != null){ sb.addEventListener(MouseEvent.CLICK, buttonFunct); }; return (sb); } override public function onKeyStayDown(key:uint):void{ switch (key){ case qPicKeys.LEFT: if (Episode == 1){ MousesDirection = -1; }; if (Episode == 2){ ThisTree.Wind(qPic.SiT(-20)); }; if (Episode == 3){ ThisTerra.rotation = (ThisTerra.rotation + qPic.SiT(180)); }; if (Episode == 4){ if (ThisTerra.x > 225){ ThisTerra.x = (ThisTerra.x - qPic.SiT(300)); }; }; if ((((Episode == 5)) && ((EpisodeTime < MaxEpisodeTime)))){ TheHumans[1].Direct = 0; }; break; case qPicKeys.RIGHT: if (Episode == 1){ MousesDirection = 1; }; if (Episode == 2){ ThisTree.Wind(qPic.SiT(20)); }; if (Episode == 3){ ThisTerra.rotation = (ThisTerra.rotation - qPic.SiT(180)); }; if (Episode == 4){ if (ThisTerra.x < 400){ ThisTerra.x = (ThisTerra.x + qPic.SiT(300)); }; }; if ((((Episode == 5)) && ((EpisodeTime < MaxEpisodeTime)))){ TheHumans[1].Direct = qPic.ScreenX; }; break; }; } override public function onKeyDown(key:uint):void{ switch (key){ case qPicKeys.M: ClickMuteButton(null); break; case qPicKeys.R: if (!IsNotEnd){ ClickRestartButton(null); }; break; case qPicKeys.SPACEBAR: ClickNextLevelButton(null); break; case qPicKeys.LMOUSE: break; }; } } }//package Games.Anima
Section 25
//Res (Games.Anima.Res) package Games.Anima { public final class Res { public static var SponsorButtonOver:Class = Res_SponsorButtonOver; public static var MyEmbeddedFont:Class = Res_MyEmbeddedFont; public static var GameEndSound:Class = Res_GameEndSound; public static var SponsorButton:Class = Res_SponsorButton; public static var SponsorButtonDown:Class = Res_SponsorButtonDown; public static var RainSound:Class = Res_RainSound; public static var GameSound:Class = Res_GameSound; public function Res(){ super(); } } }//package Games.Anima
Section 26
//Res_GameEndSound (Games.Anima.Res_GameEndSound) package Games.Anima { import mx.core.*; public class Res_GameEndSound extends SoundAsset { } }//package Games.Anima
Section 27
//Res_GameSound (Games.Anima.Res_GameSound) package Games.Anima { import mx.core.*; public class Res_GameSound extends SoundAsset { } }//package Games.Anima
Section 28
//Res_MyEmbeddedFont (Games.Anima.Res_MyEmbeddedFont) package Games.Anima { import mx.core.*; public class Res_MyEmbeddedFont extends FontAsset { } }//package Games.Anima
Section 29
//Res_RainSound (Games.Anima.Res_RainSound) package Games.Anima { import mx.core.*; public class Res_RainSound extends SoundAsset { } }//package Games.Anima
Section 30
//Res_SponsorButton (Games.Anima.Res_SponsorButton) package Games.Anima { import mx.core.*; public class Res_SponsorButton extends BitmapAsset { } }//package Games.Anima
Section 31
//Res_SponsorButtonDown (Games.Anima.Res_SponsorButtonDown) package Games.Anima { import mx.core.*; public class Res_SponsorButtonDown extends BitmapAsset { } }//package Games.Anima
Section 32
//Res_SponsorButtonOver (Games.Anima.Res_SponsorButtonOver) package Games.Anima { import mx.core.*; public class Res_SponsorButtonOver extends BitmapAsset { } }//package Games.Anima
Section 33
//BitmapAsset (mx.core.BitmapAsset) package mx.core { import flash.display.*; public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject { mx_internal static const VERSION:String = "3.2.0.3958"; public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ super(bitmapData, pixelSnapping, smoothing); } public function get measuredWidth():Number{ if (bitmapData){ return (bitmapData.width); }; return (0); } public function get measuredHeight():Number{ if (bitmapData){ return (bitmapData.height); }; return (0); } public function setActualSize(newWidth:Number, newHeight:Number):void{ width = newWidth; height = newHeight; } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } } }//package mx.core
Section 34
//FlexBitmap (mx.core.FlexBitmap) package mx.core { import flash.display.*; import mx.utils.*; public class FlexBitmap extends Bitmap { mx_internal static const VERSION:String = "3.2.0.3958"; public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ var bitmapData = bitmapData; var pixelSnapping = pixelSnapping; var smoothing = smoothing; super(bitmapData, pixelSnapping, smoothing); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 35
//FontAsset (mx.core.FontAsset) package mx.core { import flash.text.*; public class FontAsset extends Font implements IFlexAsset { mx_internal static const VERSION:String = "3.2.0.3958"; public function FontAsset(){ super(); } } }//package mx.core
Section 36
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 37
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(void:Point):Point; function get name():String; function set width(flash.display:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(flash.display:String):void; function set scaleX(flash.display:Number):void; function set scaleY(flash.display:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(flash.display:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(void:Point):Point; function get height():Number; function set blendMode(flash.display:String):void; function get parent():DisplayObjectContainer; function getBounds(String:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(flash.display:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(flash.display:Number):void; function set accessibilityProperties(flash.display:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(flash.display:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(flash.display:Number):void; function set mask(flash.display:DisplayObject):void; function getRect(String:DisplayObject):Rectangle; function get alpha():Number; function set transform(flash.display:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean; function set opaqueBackground(flash.display:Object):void; function set visible(flash.display:Boolean):void; function get mask():DisplayObject; function set x(flash.display:Number):void; function set y(flash.display:Number):void; function get transform():Transform; function set filters(flash.display:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(flash.display:Number):void; function get stage():Stage; } }//package mx.core
Section 38
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get isDocument():Boolean; function set repeaters(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function initializeRepeaterArrays(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 39
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 40
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.2.0.3958"; public function SoundAsset(){ super(); } } }//package mx.core
Section 41
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import mx.core.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "3.2.0.3958"; private static var counter:int = 0; public function NameUtil(){ super(); } public static function displayObjectToString(displayObject:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; var displayObject = displayObject; o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; //unresolved jump var _slot1 = e; return (result); } public static function createUniqueName(object:Object):String{ if (!object){ return (null); }; var name:String = getQualifiedClassName(object); var index:int = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; var charCode:int = name.charCodeAt((name.length - 1)); if ((((charCode >= 48)) && ((charCode <= 57)))){ name = (name + "_"); }; return ((name + counter++)); } } }//package mx.utils
Section 42
//MochiBot (MochiBot) package { import flash.display.*; import flash.system.*; import flash.net.*; public dynamic class MochiBot extends Sprite { public function MochiBot(){ super(); } public static function track(parent:Sprite, tag:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var self:MochiBot = new (MochiBot); parent.addChild(self); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var server:String = "http://core.mochibot.com/my/core.swf"; var lv:URLVariables = new URLVariables(); lv["sb"] = Security.sandboxType; lv["v"] = Capabilities.version; lv["swfid"] = tag; lv["mv"] = "8"; lv["fv"] = "9"; var url:String = self.root.loaderInfo.loaderURL; if (url.indexOf("http") == 0){ lv["url"] = url; } else { lv["url"] = "local"; }; var req:URLRequest = new URLRequest(server); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; var loader:Loader = new Loader(); self.addChild(loader); loader.load(req); return (self); } } }//package
Section 43
//qPicPreLoader (qPicPreLoader) package { import flash.events.*; import flash.display.*; import flash.text.*; import Engine.*; import Games.Anima.*; import flash.utils.*; public dynamic class qPicPreLoader extends MovieClip { private var _percentLoaded:Number; private var _infoField:TextField; private var LoadProgram:qPicLoading; public function qPicPreLoader(){ super(); LoadProgram = new aPicLoading(); LoadProgram.Init(this); loaderInfo.addEventListener(ProgressEvent.PROGRESS, onRootLoaderProgress); loaderInfo.addEventListener(Event.COMPLETE, onRootLoaderComplete); loaderInfo.addEventListener(Event.ENTER_FRAME, onRootLoaderEnterFrame); } private function onRootLoaderProgress(event:ProgressEvent):void{ var bytesLoaded:Number = event.target.bytesLoaded; var totalBytes:Number = event.target.bytesTotal; _percentLoaded = (bytesLoaded / totalBytes); LoadProgram.Update(_percentLoaded); } private function onRootLoaderComplete(event:Event):void{ loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onRootLoaderProgress); loaderInfo.removeEventListener(Event.COMPLETE, onRootLoaderComplete); loaderInfo.removeEventListener(Event.ENTER_FRAME, onRootLoaderComplete); LoadProgram.ProgressFinished(); addEventListener(Event.ENTER_FRAME, onRootLoaderCheckStart); } private function onRootLoaderCheckStart(event:Event):void{ if (LoadProgram.IsCanRunGame){ StartGame(); removeEventListener(Event.ENTER_FRAME, onRootLoaderCheckStart); }; } private function StartGame():void{ var app:Object; LoadProgram.DeInit(); nextFrame(); var mainClass:Class = Class(getDefinitionByName("Engine.qPic")); if (mainClass){ app = new (mainClass); addChild((app as DisplayObject)); }; } private function onRootLoaderEnterFrame(event:Event):void{ if (_percentLoaded > 99.9){ loaderInfo.removeEventListener(Event.ENTER_FRAME, onRootLoaderEnterFrame); onRootLoaderComplete(event); }; } } }//package

Library Items

Symbol 1 Font {Games.Anima.Res_MyEmbeddedFont}
Symbol 2 Bitmap {Games.Anima.Res_SponsorButton}
Symbol 3 Bitmap {Games.Anima.Res_SponsorButtonDown}
Symbol 4 Bitmap {Games.Anima.Res_SponsorButtonOver}
Symbol 5 Sound {Games.Anima.Res_RainSound} [Games.Anima.Res_RainSound]
Symbol 6 Sound {Games.Anima.Res_GameSound} [Games.Anima.Res_GameSound]
Symbol 7 Sound {Games.Anima.Res_GameEndSound} [Games.Anima.Res_GameEndSound]

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1457 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 2Symbol 5 as "Games.Anima.Res_RainSound"
ExportAssets (56)Timeline Frame 2Symbol 6 as "Games.Anima.Res_GameSound"
ExportAssets (56)Timeline Frame 2Symbol 7 as "Games.Anima.Res_GameEndSound"
EnableDebugger2 (64)Timeline Frame 131 bytes "u.$1$l3$iB7nnlrtBaW.y.L2wTBWA/."
DebugMX1 (63)Timeline Frame 1
SerialNumber (41)Timeline Frame 1

Labels

"qPicPreLoader"Frame 1
"two"Frame 2




http://swfchan.com/19/90253/info.shtml
Created: 28/3 -2019 13:21:44 Last modified: 28/3 -2019 13:21:44 Server time: 15/05 -2024 09:01:01