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

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

towerdefense3d.swf

This is the info page for
Flash #20707

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


Text
Online High Scores

Back

Continue

Score:

Life:

Gold:

<p align="left"></p>

Menu

GAME OVER!

FINAL SCORE:

Enter Name:

Tower Master Ted

Continue Without Submitting

Continue

Submit Score

Continue

Tower Defense 3D

Play Now

Play NOW

More Games

Play NOW

Do not allow your enemies to cross the
field. CliCK A Tower in the menu on the
left to select it, then click the ground to
build the tower. Use the Arrow keys to
control the camera.

Online High Scores

Play NOW

ActionScript [AS3]

Section 1
//BeeBall (BeeBall) package { public class BeeBall extends EnemyBase { public function BeeBall(){ this.kind = "BeeBall"; speed = 1.2; maxLife = 10; setLife(maxLife); goldValue = 10; } } }//package
Section 2
//BerryBall (BerryBall) package { public class BerryBall extends EnemyBase { public function BerryBall(){ this.kind = "BerryBall"; speed = 0.7; maxLife = 15; setLife(maxLife); goldValue = 10; } } }//package
Section 3
//BloodTower (BloodTower) package { public class BloodTower extends SpriteParticleBase3D { public var range:Number;// = 40 public var price:int;// = 30 public var infoDesc:String;// = "Enemies in range take double damage." public var infoName:String;// = "Blood Tower" public function BloodTower(){ infoName = "Blood Tower"; infoDesc = "Enemies in range take double damage."; price = 30; range = 40; super(); this.kind = "BloodTower"; } } }//package
Section 4
//CannonShot (CannonShot) package { public class CannonShot extends SpriteParticleBase3D { public var splash:Number; public var damage:int; public var vx:Number; public var vy:Number; public var vz:Number; public function CannonShot(){ this.kind = "CannonShot"; } } }//package
Section 5
//CannonTower (CannonTower) package { public class CannonTower extends SpriteParticleBase3D { public var range:Number;// = 35 public var price:int;// = 10 public var infoDesc:String;// = "A small fortress equipped with cannons." public var splash:Number;// = 10 public var damage:int;// = 1 public var infoName:String;// = "Cannon Fort" public var reload:int;// = 12 public var shootCounter:int; public function CannonTower(){ infoName = "Cannon Fort"; infoDesc = "A small fortress equipped with cannons."; price = 10; reload = 12; range = 35; damage = 1; splash = 10; super(); this.kind = "CannonTower"; shootCounter = int((Math.random() * 1000)); } } }//package
Section 6
//EnemyBase (EnemyBase) package { public class EnemyBase extends SpriteParticleBase3D { public var life:Number; public var poisonPoints:int;// = 0 public var inGoldRange:Boolean;// = false public var speed:Number; public var inBloodRange:Boolean;// = false public var goalIndex:int; public var maxLife:Number; public var goalY:Number; private var healthMeter:EnemyHealthMeter; public var goalX:Number; public var goldValue:int;// = 1 public function EnemyBase(){ goldValue = 1; poisonPoints = 0; inBloodRange = false; inGoldRange = false; super(); healthMeter = new EnemyHealthMeter(); addChild(healthMeter); } public function setLife(_arg1:Number):void{ life = _arg1; healthMeter.top.scaleX = (life / maxLife); } } }//package
Section 7
//EnemyCone (EnemyCone) package { import flash.display.*; public dynamic class EnemyCone extends Sprite { } }//package
Section 8
//EnemyCube (EnemyCube) package { import flash.display.*; public dynamic class EnemyCube extends Sprite { } }//package
Section 9
//EnemyCube2 (EnemyCube2) package { import flash.display.*; public dynamic class EnemyCube2 extends Sprite { } }//package
Section 10
//EnemyDonut (EnemyDonut) package { import flash.display.*; public dynamic class EnemyDonut extends MovieClip { } }//package
Section 11
//EnemyHealthMeter (EnemyHealthMeter) package { import flash.display.*; public dynamic class EnemyHealthMeter extends Sprite { public var top:MovieClip; } }//package
Section 12
//ExplosionParticle (ExplosionParticle) package { public class ExplosionParticle extends SpriteParticleBase3D { public var size:Number;// = 1 public var maxAge:int;// = 15 public var age:int;// = 0 public function ExplosionParticle(){ age = 0; maxAge = 15; size = 1; super(); this.kind = "ExplosionParticle"; this.rotation = (Math.random() * 360); } } }//package
Section 13
//FireShot (FireShot) package { public class FireShot extends SpriteParticleBase3D { public var splash:Number; public var damage:int; public var vx:Number; public var vy:Number; public var vz:Number; public function FireShot(){ this.kind = "FireShot"; } } }//package
Section 14
//FireTower (FireTower) package { public class FireTower extends SpriteParticleBase3D { public var range:Number;// = 50 public var price:int;// = 25 public var infoDesc:String;// = "A tower of fire wielding mages." public var splash:Number;// = 20 public var damage:int;// = 5 public var infoName:String;// = "Fire Tower" public var reload:int;// = 20 public var shootCounter:int; public function FireTower(){ infoName = "Fire Tower"; infoDesc = "A tower of fire wielding mages."; price = 25; reload = 20; range = 50; damage = 5; splash = 20; super(); this.kind = "FireTower"; shootCounter = int((Math.random() * 1000)); } } }//package
Section 15
//GameMenu (GameMenu) package { import flash.display.*; public dynamic class GameMenu extends Sprite { public var moreGamesBtn:SimpleButton; public var highScoresBtn:SimpleButton; public var playNowBtn:SimpleButton; } }//package
Section 16
//GameOverScreen (GameOverScreen) package { import flash.text.*; import flash.display.*; public dynamic class GameOverScreen extends Sprite { public var finalScoreTxt:TextField; public var continueBtn:SimpleButton; public var submitScoreOnlineBtn:SimpleButton; public var nameInput:TextField; } }//package
Section 17
//GoldTower (GoldTower) package { public class GoldTower extends SpriteParticleBase3D { public var range:Number;// = 30 public var price:int;// = 25 public var infoDesc:String;// = "Doubles gold from killing enemies in range." public var infoName:String;// = "Gold Tower" public function GoldTower(){ infoName = "Gold Tower"; infoDesc = "Doubles gold from killing enemies in range."; price = 25; range = 30; super(); this.kind = "GoldTower"; } } }//package
Section 18
//Herculanum (Herculanum) package { import flash.text.*; public dynamic class Herculanum extends Font { } }//package
Section 19
//HighScoresScreen (HighScoresScreen) package { import flash.text.*; import flash.display.*; public dynamic class HighScoresScreen extends Sprite { public var backBtn:SimpleButton; public var namesTxt:TextField; public var statusTxt:TextField; public var scoresTxt:TextField; } }//package
Section 20
//LaserPirateHighScoreService (LaserPirateHighScoreService) package { import flash.events.*; import flash.net.*; public class LaserPirateHighScoreService { public var successCallback:Function; public var errorCallback:Function; var gameCode:String; public function LaserPirateHighScoreService(_arg1:String){ this.gameCode = _arg1; } private function openHandler(_arg1:Event):void{ } private function securityErrorHandler(_arg1:SecurityErrorEvent):void{ errorCallback("security error"); } private function ioErrorHandler(_arg1:IOErrorEvent):void{ errorCallback("io error"); } private function completeHandler(_arg1:Event):void{ var scores:Array; var i:*; var xml:XML; var event = _arg1; try { xml = new XML(URLLoader(event.target).data); } catch(e) { errorCallback(("completeHandler try failed" + e.toString())); return; }; scores = new Array(); for each (i in xml.children()) { scores.push({name:i.name, score:i.score}); }; successCallback(scores); } private function httpStatusHandler(_arg1:HTTPStatusEvent):void{ } public function getScores(_arg1:Function, _arg2:Function):void{ var loader:URLLoader; var request:URLRequest; var successCallback = _arg1; var errorCallback = _arg2; this.successCallback = successCallback; this.errorCallback = errorCallback; loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, completeHandler); loader.addEventListener(Event.OPEN, openHandler); loader.addEventListener(ProgressEvent.PROGRESS, progressHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); try { request = new URLRequest(("http://www.laserpirate.com/generic_high_scores/get_scores.php?game_code=" + gameCode)); request.method = URLRequestMethod.POST; loader.load(request); } catch(e) { errorCallback("getScore try failed"); }; } public function submitScore(_arg1:String, _arg2:int, _arg3:Function, _arg4:Function):void{ var loader:URLLoader; var request:URLRequest; var urlVars:URLVariables; var name = _arg1; var score = _arg2; var successCallback = _arg3; var errorCallback = _arg4; this.successCallback = successCallback; this.errorCallback = errorCallback; loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, completeHandler); loader.addEventListener(Event.OPEN, openHandler); loader.addEventListener(ProgressEvent.PROGRESS, progressHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); try { request = new URLRequest("http://www.laserpirate.com/generic_high_scores/submit_score.php"); urlVars = new URLVariables(); urlVars.game_code = gameCode; urlVars.name = name; urlVars.score = score; request.data = urlVars; request.method = URLRequestMethod.POST; loader.load(request); } catch(e) { errorCallback("submitScore try failed"); }; } private function progressHandler(_arg1:ProgressEvent):void{ } } }//package
Section 21
//LizardBall (LizardBall) package { public class LizardBall extends EnemyBase { public function LizardBall(){ this.kind = "LizardBall"; speed = 0.9; maxLife = 30; setLife(maxLife); goldValue = 10; } } }//package
Section 22
//Menu (Menu) package { import flash.text.*; import flash.display.*; public dynamic class Menu extends Sprite { public var bloodBtn:SimpleButton; public var cannonBtn:SimpleButton; public var lightningBtn:SimpleButton; public var poisonBtn:SimpleButton; public var fireBtn:SimpleButton; public var mainMenuBtn:RetryBtn; public var scoreTxt:TextField; public var moonBtn:SimpleButton; public var lifeTxt:TextField; public var infoTxt:TextField; public var goldTxt:TextField; } }//package
Section 23
//ObjectParticleSystem (ObjectParticleSystem) package { import flash.display.*; public class ObjectParticleSystem extends Sprite { var particles:Object; public function ObjectParticleSystem(){ particles = new Object(); } public function killParticle(_arg1:SpriteParticleBase):void{ particles[_arg1.uid].dead = true; } public function addParticle(_arg1:SpriteParticleBase):void{ var _local2:int; _local2 = int((Math.random() * int.MAX_VALUE)); while (particles[_local2] != null) { _local2 = int((Math.random() * int.MAX_VALUE)); }; _arg1.uid = _local2; _arg1.dead = false; particles[_local2] = _arg1; addChild(_arg1); } public function clear():void{ var i:*; for (i in particles) { try { removeChild(particles[i]); } catch(e) { }; }; particles = new Object(); } public function removeDeadParticles():void{ var _local1:Array; var _local2:*; var _local3:*; _local1 = new Array(); for (_local2 in particles) { if (particles[_local2].dead){ _local1.push(particles[_local2].uid); }; }; for (_local3 in _local1) { removeChild(particles[_local1[_local3]]); delete particles[_local1[_local3]]; }; } } }//package
Section 24
//PathFinder (PathFinder) package { import flash.geom.*; import flash.display.*; public class PathFinder extends Sprite { public var px:Array; public var numPoints:int;// = 25 public var restingLength:Number; public var repelLength:Number; public var py:Array; public var transform3Dto2D:Function; public var vx:Array; public var vy:Array; public var fx:Array; public var fy:Array; public function PathFinder(_arg1:Function){ numPoints = 25; super(); this.transform3Dto2D = _arg1; px = new Array(numPoints); py = new Array(numPoints); fx = new Array(numPoints); fy = new Array(numPoints); vx = new Array(numPoints); vy = new Array(numPoints); } public function draw():void{ var _local1:int; var _local2:Point; graphics.clear(); graphics.lineStyle(1, 0xFF0000, 0.2); _local2 = transform3Dto2D(px[0], py[0], 0); graphics.moveTo(_local2.x, _local2.y); _local1 = 0; while (_local1 < numPoints) { _local2 = transform3Dto2D(px[_local1], py[_local1], 0); graphics.lineTo(_local2.x, _local2.y); _local1++; }; } public function update(_arg1:Array, _arg2):void{ var _local3:int; var _local4:int; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local3 = 1; while (_local3 < (numPoints - 1)) { fx[_local3] = 0; fy[_local3] = 0; _local3++; }; _local4 = 0; while (_local4 < _arg1.length) { if (_arg1[_local4] == _arg2){ } else { _local3 = 1; while (_local3 < (numPoints - 1)) { _local5 = (px[_local3] - _arg1[_local4].x3d); _local6 = (py[_local3] - _arg1[_local4].y3d); _local7 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); if (_local7 != 0){ _local5 = (_local5 / _local7); _local6 = (_local6 / _local7); }; _local8 = 8; if (_arg1[_local4].kind == "CannonTower"){ _local8 = 4; }; if (_arg1[_local4].kind == "GoldTower"){ _local8 = 1; }; if (_arg1[_local4].kind == "BloodTower"){ _local8 = 1; }; if (_arg1[_local4].kind == "SlowTower"){ _local8 = 6; }; if (_local7 < _arg1[_local4].range){ fx[_local3] = (fx[_local3] + ((_local8 * _local5) / (_arg1.length + 1))); fy[_local3] = (fy[_local3] + ((_local8 * _local6) / (_arg1.length + 1))); }; _local3++; }; }; _local4++; }; _local3 = 1; while (_local3 < (numPoints - 1)) { _local5 = (px[_local3] - px[(_local3 + 1)]); _local6 = (py[_local3] - py[(_local3 + 1)]); _local7 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); if (_local7 != 0){ _local5 = (_local5 / _local7); _local6 = (_local6 / _local7); }; if (_local7 > restingLength){ fx[_local3] = (fx[_local3] - ((0.3 * _local7) * _local5)); fy[_local3] = (fy[_local3] - ((0.3 * _local7) * _local6)); }; if (_local7 < repelLength){ fx[_local3] = (fx[_local3] + ((0.5 * _local7) * _local5)); fy[_local3] = (fy[_local3] + ((0.5 * _local7) * _local6)); }; _local3++; }; _local3 = 1; while (_local3 < (numPoints - 1)) { _local5 = (px[_local3] - px[(_local3 - 1)]); _local6 = (py[_local3] - py[(_local3 - 1)]); _local7 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); if (_local7 != 0){ _local5 = (_local5 / _local7); _local6 = (_local6 / _local7); }; if (_local7 > restingLength){ fx[_local3] = (fx[_local3] - ((0.3 * _local7) * _local5)); fy[_local3] = (fy[_local3] - ((0.3 * _local7) * _local6)); }; if (_local7 < repelLength){ fx[_local3] = (fx[_local3] + ((0.5 * _local7) * _local5)); fy[_local3] = (fy[_local3] + ((0.5 * _local7) * _local6)); }; _local3++; }; _local3 = 1; while (_local3 < (numPoints - 1)) { vx[_local3] = (vx[_local3] + fx[_local3]); vy[_local3] = (vy[_local3] + fy[_local3]); vx[_local3] = (vx[_local3] * 0.9); vy[_local3] = (vy[_local3] * 0.9); px[_local3] = (px[_local3] + (0.1 * vx[_local3])); py[_local3] = (py[_local3] + (0.1 * vy[_local3])); _local3++; }; } public function setStartAndEnd(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){ var _local5:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; _local5 = 0; while (_local5 < numPoints) { _local9 = (Number(_local5) / Number((numPoints - 1))); px[_local5] = ((_arg1 * _local9) + (_arg3 * (1 - _local9))); py[_local5] = ((_arg2 * _local9) + (_arg4 * (1 - _local9))); vx[_local5] = 0; vy[_local5] = 0; _local5++; }; _local6 = (_arg1 - _arg3); _local7 = (_arg2 - _arg4); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); restingLength = ((2 * _local8) / numPoints); repelLength = ((0.9 * _local8) / numPoints); } } }//package
Section 25
//PeacockBall (PeacockBall) package { public class PeacockBall extends EnemyBase { public function PeacockBall(){ this.kind = "PeacockBall"; speed = 1.1; maxLife = 20; setLife(maxLife); goldValue = 6; } } }//package
Section 26
//PoisonTower (PoisonTower) package { public class PoisonTower extends SpriteParticleBase3D { public var range:Number;// = 40 public var price:int;// = 40 public var infoDesc:String;// = "Slows a nearby enemy." public var infoName:String;// = "Poison Tower" public var reload:int;// = 16 public var shootCounter:int; public function PoisonTower(){ price = 40; reload = 16; range = 40; infoName = "Poison Tower"; infoDesc = "Slows a nearby enemy."; super(); this.kind = "PoisonTower"; shootCounter = int((Math.random() * 1000)); } } }//package
Section 27
//RangeCircle (RangeCircle) package { public class RangeCircle extends SpriteParticleBase3D { } }//package
Section 28
//RetryBtn (RetryBtn) package { import flash.display.*; public dynamic class RetryBtn extends SimpleButton { } }//package
Section 29
//SpriteParticleBase (SpriteParticleBase) package { import flash.display.*; public class SpriteParticleBase extends Sprite { public var type:String; public var uid:int; public var dead:Boolean; } }//package
Section 30
//SpriteParticleBase3D (SpriteParticleBase3D) package { public class SpriteParticleBase3D extends SpriteParticleBase { public var x3d:Number; public var scaleY3d:Number;// = 1 public var scaleX3d:Number;// = 1 public var z3d:Number; public var kind:String; public var y3d:Number; public function SpriteParticleBase3D(){ scaleX3d = 1; scaleY3d = 1; super(); } } }//package
Section 31
//TextParticle (TextParticle) package { import flash.text.*; public class TextParticle extends SpriteParticleBase3D { public var txt:TextField; public var age:int;// = 0 public function TextParticle(_arg1:uint=16755234){ var _local2:TextFormat; age = 0; super(); this.kind = "TextParticle"; _local2 = new TextFormat(); _local2.color = _arg1; _local2.size = 14; _local2.font = "Herculanum"; txt = new TextField(); txt.embedFonts = true; txt.defaultTextFormat = _local2; txt.width = 100; txt.height = 30; txt.selectable = false; addChild(txt); } } }//package
Section 32
//TextureMap (TextureMap) package { import flash.display.*; public dynamic class TextureMap extends BitmapData { public function TextureMap(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 33
//ToadBall (ToadBall) package { public class ToadBall extends EnemyBase { public function ToadBall(){ this.kind = "ToadBall"; speed = 0.6; maxLife = 100; setLife(maxLife); goldValue = 30; } } }//package
Section 34
//TowerDefense3D (TowerDefense3D) package { import flash.events.*; import flash.geom.*; import flash.display.*; import flash.net.*; import flash.ui.*; public class TowerDefense3D extends Sprite { public var spawnCounter:int;// = 0 public var ps:ObjectParticleSystem; public var textureHeight:int;// = 0x0200 public var currTowerKind:String;// = "none" public var leftKeyPressed:Boolean;// = false public var currBallType:int;// = 0 public var gold:int; public var texturemap:TextureMap; public var rangeCircle:RangeCircle; public var gameMenu:GameMenu; public var t:Number;// = 0 var bmContainer:Sprite; var highScoreService:LaserPirateHighScoreService; public var dt:Number;// = 0.01 public var score:int; public var pathfinder:PathFinder; private var highScoresScreen:HighScoresScreen; public var spawnDelay:int;// = 100 public var draggingTower; public var life:int; public var downKeyPressed:Boolean;// = false public var numBallsSpawned:int;// = 0 public var particlesToAddAfterDestroyPhase:Array; public var menu:Menu; public var textureWidth:int;// = 0x0200 public var speedMultiplier:Number;// = 1 public var gameActive:Boolean;// = false public var useSmoothing:Boolean;// = false public var upKeyPressed:Boolean;// = false public var zoom:Number;// = 2.5 public var squishH:Number;// = 0.5 public var mouseIsDown:Boolean;// = false public var gameOverScreen:GameOverScreen; public var rotationAngle:Number;// = 60 public var scaleAll:Sprite; public var rightKeyPressed:Boolean;// = false public static const SCREEN_WIDTH:int = 640; public static const towerBuildRadius:Number = 30; public static const SCREEN_HEIGHT:int = 480; public static const SHOT_COLLIDE_R2:Number = 196; public static const GRAVITY:Number = 1.2; public function TowerDefense3D(){ var _local1:Sprite; var _local2:Bitmap; textureWidth = 0x0200; textureHeight = 0x0200; useSmoothing = false; zoom = 2.5; rotationAngle = 60; squishH = 0.5; t = 0; dt = 0.01; mouseIsDown = false; downKeyPressed = false; upKeyPressed = false; leftKeyPressed = false; rightKeyPressed = false; currTowerKind = "none"; spawnCounter = 0; spawnDelay = 100; speedMultiplier = 1; currBallType = 0; numBallsSpawned = 0; gameActive = false; super(); stage.scaleMode = StageScaleMode.EXACT_FIT; highScoreService = new LaserPirateHighScoreService("tower_def_3d"); texturemap = new TextureMap(textureWidth, textureHeight); scaleAll = new Sprite(); addChild(scaleAll); scaleAll.x = 320; scaleAll.y = 240; _local1 = new Sprite(); bmContainer = new Sprite(); _local2 = new Bitmap(texturemap); _local2.smoothing = true; _local1.addChild(bmContainer); bmContainer.addChild(_local2); scaleAll.addChild(_local1); _local2.x = (-(textureWidth) / 2); _local2.y = (-(textureHeight) / 2); _local1.scaleY = squishH; ps = new ObjectParticleSystem(); addChild(ps); rangeCircle = new RangeCircle(); ps.addParticle(rangeCircle); rangeCircle.visible = false; pathfinder = new PathFinder(transform3Dto2D); pathfinder.setStartAndEnd(0, 200, 0x0200, 300); addChild(pathfinder); menu = new Menu(); addChild(menu); menu.x = 8; menu.y = 50; menu.visible = false; gameMenu = new GameMenu(); gameMenu.x = ((SCREEN_WIDTH / 2) - (gameMenu.width / 2)); gameMenu.y = 50; addChild(gameMenu); gameOverScreen = new GameOverScreen(); addChild(gameOverScreen); gameOverScreen.x = ((SCREEN_WIDTH / 2) - (gameOverScreen.width / 2)); gameOverScreen.y = 50; gameOverScreen.visible = false; highScoresScreen = new HighScoresScreen(); addChild(highScoresScreen); highScoresScreen.visible = false; gameMenu.playNowBtn.addEventListener(MouseEvent.CLICK, playNowBtnHandler); gameMenu.moreGamesBtn.addEventListener(MouseEvent.CLICK, moreGamesBtnHandler); gameMenu.highScoresBtn.addEventListener(MouseEvent.CLICK, getHighScores); gameOverScreen.continueBtn.addEventListener(MouseEvent.CLICK, continueBtnHandler); highScoresScreen.backBtn.addEventListener(MouseEvent.CLICK, continueBtnHandler); gameOverScreen.submitScoreOnlineBtn.addEventListener(MouseEvent.CLICK, submitOnlineHandler); menu.cannonBtn.addEventListener(MouseEvent.CLICK, cannonBtnHandler); menu.fireBtn.addEventListener(MouseEvent.CLICK, fireBtnHandler); menu.lightningBtn.addEventListener(MouseEvent.CLICK, lightningBtnHandler); menu.poisonBtn.addEventListener(MouseEvent.CLICK, poisonBtnHandler); menu.bloodBtn.addEventListener(MouseEvent.CLICK, bloodBtnHandler); menu.moonBtn.addEventListener(MouseEvent.CLICK, moonBtnHandler); menu.mainMenuBtn.addEventListener(MouseEvent.CLICK, mainMenuBtnHandler); newGame(); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); addEventListener(Event.ENTER_FRAME, update); addEventListener(MouseEvent.MOUSE_UP, stageMouseUpHandler); } public function transform2Dto3D(_arg1:Number, _arg2:Number):Point{ var _local3:Point; var _local4:Matrix; _local3 = new Point(_arg1, _arg2); _local3.x = (_local3.x - (SCREEN_WIDTH / 2)); _local3.y = (_local3.y - (SCREEN_HEIGHT / 2)); _local3.x = (_local3.x / zoom); _local3.y = (_local3.y / zoom); _local3.y = (_local3.y / squishH); _local4 = new Matrix(); _local4.rotate(((-(Math.PI) * rotationAngle) / 180)); _local3 = _local4.deltaTransformPoint(_local3); _local3.x = (_local3.x + (textureWidth / 2)); _local3.y = (_local3.y + (textureHeight / 2)); return (_local3); } public function shotCollidesWithEnemy(_arg1, _arg2):Boolean{ var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; _local3 = (_arg1.x3d - _arg2.x3d); _local4 = (_arg1.y3d - _arg2.y3d); _local5 = (_arg1.z3d - _arg2.z3d); _local6 = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5)); return ((_local6 < SHOT_COLLIDE_R2)); } public function fireBtnHandler(_arg1):void{ var _local2:*; _local2 = new FireTower(); attachDraggingTower(_local2); } public function mainMenuBtnHandler(_arg1):void{ draggingTower = null; rangeCircle = null; ps.clear(); menu.visible = false; gameActive = false; gameMenu.visible = true; } public function towerPositionIsInvalid(_arg1, _arg2):Boolean{ var _local3:int; if (_arg1.x3d < 110){ return (true); }; if (_arg1.y3d < 110){ return (true); }; if (_arg1.x3d > (textureWidth - 110)){ return (true); }; if (_arg1.y3d > (textureHeight - 110)){ return (true); }; _local3 = 0; while (_local3 < _arg2.length) { if (_arg2[_local3] == _arg1){ } else { if (collisionCheck2D(_arg1, _arg2[_local3], towerBuildRadius)){ return (true); }; }; _local3++; }; return (false); } public function submitOnlineHandler(_arg1):void{ var e = _arg1; gameOverScreen.visible = false; highScoresScreen.visible = true; highScoresScreen.statusTxt.text = "Sending Score..."; highScoresScreen.namesTxt.text = ""; highScoresScreen.scoresTxt.text = ""; highScoreService.submitScore(gameOverScreen.nameInput.text, score, function (_arg1:Array){ var _local2:*; highScoresScreen.statusTxt.text = ""; for each (_local2 in _arg1) { highScoresScreen.namesTxt.appendText((_local2.name + "\n")); highScoresScreen.scoresTxt.appendText((_local2.score + "\n")); }; }, function (_arg1:String){ highScoresScreen.statusTxt.text = "High scores are not available right now."; }); } public function cannonBtnHandler(_arg1):void{ var _local2:*; _local2 = new CannonTower(); attachDraggingTower(_local2); } public function spawnEnemies():void{ var _local1:*; switch ((currBallType % 6)){ case 0: _local1 = new BerryBall(); break; case 1: _local1 = new WoodBall(); break; case 2: _local1 = new PeacockBall(); break; case 3: _local1 = new LizardBall(); break; case 4: _local1 = new ToadBall(); break; case 5: _local1 = new BeeBall(); break; default: throw (new Error("ball type wrong")); }; numBallsSpawned++; if ((numBallsSpawned % 4) == 0){ currBallType++; speedMultiplier = (speedMultiplier + 0.15); spawnDelay = (spawnDelay - 4); if (spawnDelay < 50){ spawnDelay = 50; }; }; _local1.goalIndex = 1; _local1.x3d = pathfinder.px[0]; _local1.y3d = pathfinder.py[0]; _local1.goalX = pathfinder.px[_local1.goalIndex]; _local1.goalY = pathfinder.py[_local1.goalIndex]; _local1.z3d = 0; ps.addParticle(_local1); } public function getHighScores(_arg1):void{ var e = _arg1; gameMenu.visible = false; gameOverScreen.visible = false; highScoresScreen.visible = true; highScoresScreen.statusTxt.text = "Getting Scores..."; highScoresScreen.namesTxt.text = ""; highScoresScreen.scoresTxt.text = ""; highScoreService.getScores(function (_arg1:Array){ var _local2:*; highScoresScreen.statusTxt.text = ""; for each (_local2 in _arg1) { highScoresScreen.namesTxt.appendText((_local2.name + "\n")); highScoresScreen.scoresTxt.appendText((_local2.score + "\n")); }; }, function (_arg1:String){ highScoresScreen.statusTxt.text = "High scores are not available right now."; }); } function keyDownHandler(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.DOWN){ downKeyPressed = true; }; if (_arg1.keyCode == Keyboard.UP){ upKeyPressed = true; }; if (_arg1.keyCode == Keyboard.LEFT){ leftKeyPressed = true; }; if (_arg1.keyCode == Keyboard.RIGHT){ rightKeyPressed = true; }; } public function transform3Dto2D(_arg1:Number, _arg2:Number, _arg3:Number):Point{ var _local4:Number; var _local5:Number; var _local6:Point; var _local7:Matrix; _local4 = (_arg1 - (textureWidth / 2)); _local5 = (_arg2 - (textureHeight / 2)); _local6 = new Point(_local4, _local5); _local7 = new Matrix(); _local7.rotate(((Math.PI * rotationAngle) / 180)); var _temp1 = _local7.deltaTransformPoint(_local6); _local6 = _local7.deltaTransformPoint(_local6); _temp1.y = (_local6.y - _arg3); _local6.y = (_local6.y * squishH); _local6.x = (_local6.x * zoom); _local6.y = (_local6.y * zoom); _local6.x = (_local6.x + (SCREEN_WIDTH / 2)); _local6.y = (_local6.y + (SCREEN_HEIGHT / 2)); return (_local6); } public function setLife(_arg1:int):void{ life = _arg1; menu.lifeTxt.text = ("Life: " + _arg1); } public function setDescriptionText():void{ var _local1:String; var _local2:String; if (draggingTower == null){ menu.infoTxt.htmlText = ""; return; }; _local1 = ("<br>Price: " + draggingTower.price); if (gold < draggingTower.price){ _local1 = (("<br><font color='#FF0000'>Price: " + draggingTower.price) + "</font>"); }; _local2 = (((draggingTower.infoName + _local1) + "<br>Range: ") + draggingTower.range); if ((((((draggingTower.kind == "CannonTower")) || ((draggingTower.kind == "FireTower")))) || ((draggingTower.kind == "WaterTower")))){ _local2 = (_local2 + ("<br>Reload: " + draggingTower.reload)); _local2 = (_local2 + ("<br>Damage: " + draggingTower.damage)); _local2 = (_local2 + ("<br>Splash: " + draggingTower.splash)); }; _local2 = (_local2 + ("<br><br>" + draggingTower.infoDesc)); menu.infoTxt.htmlText = _local2; } public function towerShoot(_arg1, _arg2):void{ var _local3:Number; var _local4:Number; var _local5:Number; var _local6:*; var _local7:Number; var _local8:*; var _local9:Number; var _local10:Number; _local6 = findClosestEnemyToTower(_arg1, _arg2); if (_local6 == null){ return; }; if (_arg1.kind == "GoldTower"){ return; }; if (_arg1.kind == "PoisonTower"){ _local3 = (_local6.x3d - _arg1.x3d); _local4 = (_local6.y3d - _arg1.y3d); if (((_local3 * _local3) + (_local4 * _local4)) < (_arg1.range * _arg1.range)){ _local6.poisonPoints = 100; }; return; } else { if (_arg1.kind == "CannonTower"){ _local8 = new CannonShot(); _local8.damage = _arg1.damage; _local8.splash = _arg1.splash; _local7 = 20; } else { if (_arg1.kind == "FireTower"){ _local8 = new FireShot(); _local8.damage = _arg1.damage; _local8.splash = _arg1.splash; _local7 = 40; } else { if (_arg1.kind == "WaterTower"){ _local8 = new WaterShot(); _local8.damage = _arg1.damage; _local8.splash = _arg1.splash; _local7 = 15; }; }; }; }; _local8.x3d = _arg1.x3d; _local8.y3d = _arg1.y3d; _local8.z3d = (_arg1.z3d + _local7); _local3 = (_local6.x3d - _local8.x3d); _local4 = (_local6.y3d - _local8.y3d); _local5 = (_local6.z3d - _local8.z3d); _local9 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4))); if (_local9 > _arg1.range){ return; }; _local10 = Math.sqrt((((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5))); if (_local10 != 0){ _local3 = (_local3 / _local10); _local4 = (_local4 / _local10); _local5 = (_local5 / _local10); }; _local8.vx = (4 * _local3); _local8.vy = (4 * _local4); _local8.vz = (4 * _local5); ps.addParticle(_local8); } function keyUpHandler(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.DOWN){ downKeyPressed = false; }; if (_arg1.keyCode == Keyboard.UP){ upKeyPressed = false; }; if (_arg1.keyCode == Keyboard.LEFT){ leftKeyPressed = false; }; if (_arg1.keyCode == Keyboard.RIGHT){ rightKeyPressed = false; }; } public function poisonBtnHandler(_arg1):void{ var _local2:*; _local2 = new PoisonTower(); attachDraggingTower(_local2); } public function enemyIsInTowerRange(_arg1, _arg2):Boolean{ var _local3:Number; var _local4:Number; var _local5:Number; _local3 = (_arg1.x3d - _arg2.x3d); _local4 = (_arg1.y3d - _arg2.y3d); _local5 = ((_local3 * _local3) + (_local4 * _local4)); return ((_local5 < (_arg1.range * _arg1.range))); } public function attachDraggingTower(_arg1):void{ currTowerKind = _arg1.kind; draggingTower = _arg1; ps.addParticle(_arg1); _arg1.mouseEnabled = false; _arg1.alpha = 0.5; rangeCircle.scaleX3d = (_arg1.range / 100); rangeCircle.scaleY3d = (_arg1.range / 100); setDescriptionText(); } public function update(_arg1):void{ var a:int; var b:int; var i:int; var j:String; var dx:Number; var dy:Number; var enemyRefs:Array; var particleRefs:Array; var towerRefs:Array; var shotRefs:Array; var damage:int; var explosion:ExplosionParticle; var plusScoreParticle:TextParticle; var goldValue:int; var p:*; var p3d:Point; var point2D:Point; var beta:Number; var speedMult:Number; var r:Number; var reachGoalRadius:Number; var vx:Number; var vy:Number; var tp:TextParticle; var e = _arg1; if (gameActive){ if (leftKeyPressed){ rotationAngle = (rotationAngle + 2.5); }; if (rightKeyPressed){ rotationAngle = (rotationAngle - 2.5); }; if (upKeyPressed){ zoom = (zoom * 1.05); }; if (downKeyPressed){ zoom = (zoom * 0.95); }; if (zoom < 1){ zoom = 1; }; if (zoom > 4){ zoom = 4; }; } else { rotationAngle = (rotationAngle + 0.125); }; bmContainer.rotation = rotationAngle; scaleAll.scaleX = zoom; scaleAll.scaleY = zoom; if (!gameActive){ return; }; t = (t + dt); setDescriptionText(); spawnCounter++; if ((spawnCounter % spawnDelay) == 0){ spawnEnemies(); }; enemyRefs = new Array(); particleRefs = new Array(); towerRefs = new Array(); for (j in ps.particles) { particleRefs.push(ps.particles[j]); if ((((((((((((ps.particles[j].kind == "CannonTower")) || ((ps.particles[j].kind == "FireTower")))) || ((ps.particles[j].kind == "WaterTower")))) || ((ps.particles[j].kind == "PoisonTower")))) || ((ps.particles[j].kind == "GoldTower")))) || ((ps.particles[j].kind == "BloodTower")))){ towerRefs.push(ps.particles[j]); }; if ((((((((((((ps.particles[j].kind == "WoodBall")) || ((ps.particles[j].kind == "BeeBall")))) || ((ps.particles[j].kind == "BerryBall")))) || ((ps.particles[j].kind == "LizardBall")))) || ((ps.particles[j].kind == "PeacockBall")))) || ((ps.particles[j].kind == "ToadBall")))){ enemyRefs.push(ps.particles[j]); }; }; i = 0; while (i < particleRefs.length) { if ((((((((particleRefs[i].kind == "CannonTower")) || ((particleRefs[i].kind == "FireTower")))) || ((particleRefs[i].kind == "WaterTower")))) || ((particleRefs[i].kind == "PoisonTower")))){ particleRefs[i].shootCounter++; if (((((particleRefs[i].shootCounter % particleRefs[i].reload) == 0)) && (!((draggingTower == particleRefs[i]))))){ towerShoot(particleRefs[i], enemyRefs); }; }; i = (i + 1); }; pathfinder.update(towerRefs, draggingTower); pathfinder.draw(); if (particlesToAddAfterDestroyPhase != null){ i = 0; while (i < particlesToAddAfterDestroyPhase.length) { ps.addParticle(particlesToAddAfterDestroyPhase[i]); i = (i + 1); }; }; particlesToAddAfterDestroyPhase = new Array(); if (draggingTower != null){ if (menu.hitTestPoint(mouseX, mouseY)){ draggingTower.alpha = 0; rangeCircle.visible = false; } else { rangeCircle.visible = true; draggingTower.alpha = 0.5; draggingTower.transform.colorTransform = new ColorTransform(); if ((((gold < draggingTower.price)) || (towerPositionIsInvalid(draggingTower, towerRefs)))){ draggingTower.alpha = 0; draggingTower.transform.colorTransform = new ColorTransform(1, 0.5, 0.5, 1, 64, 0, 0, 0); }; }; }; shotRefs = new Array(); for (j in ps.particles) { if ((((((ps.particles[j].kind == "CannonShot")) || ((ps.particles[j].kind == "FireShot")))) || ((ps.particles[j].kind == "WaterShot")))){ shotRefs.push(ps.particles[j]); }; }; b = 0; while (b < enemyRefs.length) { enemyRefs[b].inBloodRange = false; enemyRefs[b].inGoldRange = false; b = (b + 1); }; a = 0; while (a < towerRefs.length) { if (towerRefs[a] == draggingTower){ } else { b = 0; while (b < enemyRefs.length) { if ((((towerRefs[a].kind == "GoldTower")) || ((towerRefs[a].kind == "BloodTower")))){ if (enemyIsInTowerRange(towerRefs[a], enemyRefs[b])){ if (towerRefs[a].kind == "GoldTower"){ enemyRefs[b].inGoldRange = true; }; if (towerRefs[a].kind == "BloodTower"){ enemyRefs[b].inBloodRange = true; }; }; }; b = (b + 1); }; }; a = (a + 1); }; a = 0; while (a < shotRefs.length) { b = 0; while (b < enemyRefs.length) { if (shotCollidesWithEnemy(shotRefs[a], enemyRefs[b])){ if (shotRefs[a].kind != "WaterShot"){ explosion = new ExplosionParticle(); explosion.x3d = enemyRefs[b].x3d; explosion.y3d = enemyRefs[b].y3d; explosion.z3d = enemyRefs[b].z3d; particlesToAddAfterDestroyPhase.push(explosion); if (shotRefs[a].kind == "FireShot"){ explosion.size = 2; }; }; ps.killParticle(shotRefs[a]); damage = shotRefs[a].damage; if (enemyRefs[b].inBloodRange){ damage = (damage * 2); }; enemyRefs[b].setLife((enemyRefs[b].life - damage)); if (enemyRefs[b].life <= 0){ setScore((score + (50 * enemyRefs[b].goldValue))); setGold((gold + enemyRefs[b].goldValue)); plusScoreParticle = new TextParticle(); goldValue = enemyRefs[b].goldValue; if (enemyRefs[b].inGoldRange){ goldValue = (goldValue * 2); }; plusScoreParticle.txt.text = ("+" + goldValue); plusScoreParticle.x3d = enemyRefs[b].x3d; plusScoreParticle.y3d = enemyRefs[b].y3d; plusScoreParticle.z3d = 0; particlesToAddAfterDestroyPhase.push(plusScoreParticle); ps.killParticle(enemyRefs[b]); }; }; b = (b + 1); }; a = (a + 1); }; particleRefs = new Array(); for (j in ps.particles) { p = ps.particles[j]; if (p.dead){ } else { if (p == draggingTower){ p3d = transform2Dto3D(mouseX, mouseY); p.x3d = p3d.x; p.y3d = p3d.y; p.z3d = 0; }; if (p == rangeCircle){ p3d = transform2Dto3D(mouseX, mouseY); p.x3d = p3d.x; p.y3d = p3d.y; p.z3d = -1; }; if (p.kind == "TextParticle"){ p.age++; if (p.age > 50){ ps.killParticle(p); continue; }; p.z3d = (3 * p.age); p.alpha = (1 - (p.age / 50)); }; if (p.kind == "ExplosionParticle"){ p.age++; if (p.age > p.maxAge){ ps.killParticle(p); continue; }; beta = (1 - (p.age / p.maxAge)); p.alpha = beta; p.scaleX3d = (beta * p.size); p.scaleY3d = (beta * p.size); }; if ((((((p.kind == "CannonShot")) || ((p.kind == "FireShot")))) || ((p.kind == "WaterShot")))){ p.x3d = (p.x3d + p.vx); p.y3d = (p.y3d + p.vy); p.z3d = (p.z3d + p.vz); //unresolved if ps.killParticle(p); } else { if ((((((((((((p.kind == "WoodBall")) || ((p.kind == "BeeBall")))) || ((p.kind == "BerryBall")))) || ((p.kind == "LizardBall")))) || ((p.kind == "PeacockBall")))) || ((p.kind == "ToadBall")))){ speedMult = speedMultiplier; if (p.poisonPoints > 0){ speedMult = (speedMult * 0.5); p.poisonPoints--; p.transform.colorTransform = new ColorTransform(0.5, 1, 0.5, 1, 0, 64, 0, 0); } else { if (p.inBloodRange){ p.transform.colorTransform = new ColorTransform(1, 0.5, 0.5, 1, 64, 0, 0, 0); } else { if (p.inGoldRange){ p.transform.colorTransform = new ColorTransform(1, 1, 0.5, 1, 64, 64, 0, 0); } else { p.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0); }; }; }; dx = (p.goalX - p.x3d); dy = (p.goalY - p.y3d); r = Math.sqrt(((dx * dx) + (dy * dy))); if (r != 0){ dx = (dx / r); dy = (dy / r); }; reachGoalRadius = 8; if (r < reachGoalRadius){ p.goalIndex++; if (p.goalIndex >= (pathfinder.numPoints - 1)){ setLife((life - 1)); ps.killParticle(p); tp = new TextParticle(0xCC0000); tp.txt.text = "-1"; tp.x3d = p.x3d; tp.y3d = p.y3d; tp.z3d = 0; particlesToAddAfterDestroyPhase.push(tp); } else { p.goalX = ((pathfinder.px[p.goalIndex] + (Math.random() * 50)) - 25); p.goalY = ((pathfinder.py[p.goalIndex] + (Math.random() * 50)) - 25); }; continue; }; vx = ((speedMult * p.speed) * dx); vy = ((speedMult * p.speed) * dy); p.x3d = (p.x3d + vx); p.y3d = (p.y3d + vy); p.z3d = 0; }; point2D = transform3Dto2D(p.x3d, p.y3d, p.z3d); p.x = point2D.x; p.y = point2D.y; ps.removeChild(p); particleRefs.push({p:ps.particles[j], y:(ps.particles[j].y + ps.particles[j].z3d)}); }; }; }; particleRefs.sort(function (_arg1:Object, _arg2:Object){ return (((_arg1.y < _arg2.y)) ? -1 : 1); }); i = 0; while (i < particleRefs.length) { particleRefs[i].p.scaleX = (particleRefs[i].p.scaleX3d * zoom); particleRefs[i].p.scaleY = (particleRefs[i].p.scaleY3d * zoom); ps.addChild(particleRefs[i].p); i = (i + 1); }; particleRefs = null; ps.removeDeadParticles(); if (life <= 0){ gameOver(); return; }; } public function moreGamesBtnHandler(_arg1):void{ var e = _arg1; try { navigateToURL(new URLRequest("http://www.flashgamealot.com")); } catch(e) { }; } public function bloodBtnHandler(_arg1):void{ var _local2:*; _local2 = new BloodTower(); attachDraggingTower(_local2); } public function findClosestEnemyToTower(_arg1, _arg2:Array){ var _local3:Number; var _local4:*; var _local5:*; var _local6:Number; var _local7:Number; var _local8:Number; if (_arg2.length == 0){ return (null); }; _local3 = Number.MAX_VALUE; _local5 = 0; while (_local5 < _arg2.length) { _local6 = (_arg1.x3d - _arg2[_local5].x3d); _local7 = (_arg1.y3d - _arg2[_local5].y3d); _local8 = ((_local6 * _local6) + (_local7 * _local7)); if (_local8 < _local3){ _local3 = _local8; _local4 = _arg2[_local5]; }; _local5++; }; return (_local4); } public function moonBtnHandler(_arg1):void{ var _local2:*; _local2 = new WaterTower(); attachDraggingTower(_local2); } public function setScore(_arg1:int):void{ score = _arg1; menu.scoreTxt.text = ("Score: " + _arg1); } public function continueBtnHandler(_arg1):void{ gameMenu.visible = true; gameOverScreen.visible = false; highScoresScreen.visible = false; } public function stageMouseUpHandler(_arg1):void{ var _local2:Array; var _local3:*; mouseIsDown = false; if (draggingTower != null){ if (menu.hitTestPoint(mouseX, mouseY)){ currTowerKind = "none"; menu.infoTxt.text = ""; ps.killParticle(draggingTower); ps.removeDeadParticles(); draggingTower = null; } else { _local2 = new Array(); for (_local3 in ps.particles) { if ((((((((((((ps.particles[_local3].kind == "CannonTower")) || ((ps.particles[_local3].kind == "FireTower")))) || ((ps.particles[_local3].kind == "WaterTower")))) || ((ps.particles[_local3].kind == "PoisonTower")))) || ((ps.particles[_local3].kind == "GoldTower")))) || ((ps.particles[_local3].kind == "BloodTower")))){ _local2.push(ps.particles[_local3]); }; }; if ((((gold >= draggingTower.price)) && (!(towerPositionIsInvalid(draggingTower, _local2))))){ setGold((gold - draggingTower.price)); draggingTower.mouseEnabled = true; draggingTower.alpha = 1; draggingTower = null; switch (currTowerKind){ case "CannonTower": attachDraggingTower(new CannonTower()); break; case "FireTower": attachDraggingTower(new FireTower()); break; case "WaterTower": attachDraggingTower(new WaterTower()); break; case "PoisonTower": attachDraggingTower(new PoisonTower()); break; case "GoldTower": attachDraggingTower(new GoldTower()); break; case "BloodTower": attachDraggingTower(new BloodTower()); break; default: break; }; }; }; }; } public function newGame():void{ pathfinder.setStartAndEnd(0, 200, 0x0200, 300); draggingTower = null; rangeCircle = null; ps.clear(); rangeCircle = new RangeCircle(); ps.addParticle(rangeCircle); rangeCircle.visible = false; particlesToAddAfterDestroyPhase = new Array(); draggingTower = null; currTowerKind = "none"; setScore(0); setLife(10); setGold(50); speedMultiplier = 1; spawnDelay = 100; currBallType = 0; numBallsSpawned = 0; } public function lightningBtnHandler(_arg1):void{ var _local2:*; _local2 = new GoldTower(); attachDraggingTower(_local2); } public function collisionCheck2D(_arg1, _arg2, _arg3:Number):Boolean{ var _local4:Number; var _local5:Number; var _local6:Number; _local4 = (_arg1.x3d - _arg2.x3d); _local5 = (_arg1.y3d - _arg2.y3d); _local6 = ((_local4 * _local4) + (_local5 * _local5)); return ((_local6 < (_arg3 * _arg3))); } public function gameOver():void{ draggingTower = null; rangeCircle = null; ps.clear(); gameOverScreen.visible = true; menu.visible = false; gameActive = false; gameOverScreen.finalScoreTxt.text = ("Final Score: " + score); } public function setGold(_arg1:int):void{ gold = _arg1; menu.goldTxt.text = ("Gold: " + _arg1); } function playNowBtnHandler(_arg1):void{ menu.visible = true; gameMenu.visible = false; gameActive = true; newGame(); } } }//package
Section 35
//WaterShot (WaterShot) package { public class WaterShot extends SpriteParticleBase3D { public var splash:Number; public var damage:int; public var vx:Number; public var vy:Number; public var vz:Number; public function WaterShot(){ this.kind = "WaterShot"; } } }//package
Section 36
//WaterTower (WaterTower) package { public class WaterTower extends SpriteParticleBase3D { public var range:Number;// = 40 public var price:int;// = 15 public var infoDesc:String;// = "An enchanted shrine that shoots water." public var splash:Number;// = 15 public var damage:int;// = 2 public var infoName:String;// = "Water Tower" public var reload:int;// = 15 public var shootCounter:int; public function WaterTower(){ infoName = "Water Tower"; infoDesc = "An enchanted shrine that shoots water."; price = 15; reload = 15; range = 40; damage = 2; splash = 15; super(); this.kind = "WaterTower"; shootCounter = int((Math.random() * 1000)); } } }//package
Section 37
//WoodBall (WoodBall) package { public class WoodBall extends EnemyBase { public function WoodBall(){ this.kind = "WoodBall"; speed = 0.8; maxLife = 20; setLife(maxLife); goldValue = 2; } } }//package

Library Items

Symbol 1 Font {Herculanum}Used by:54 55 56 63
Symbol 2 Bitmap {TextureMap}
Symbol 3 GraphicUsed by:4
Symbol 4 MovieClipUses:3Used by:17 69 88 100
Symbol 5 FontUsed by:6 9 12 14 15 16 65 78 79 80 81 82 83 85 86 89 90 91 93 94 96 97 98
Symbol 6 EditableTextUses:5Used by:7
Symbol 7 MovieClipUses:6Used by:17
Symbol 8 GraphicUsed by:13 84 87 92 95 99
Symbol 9 EditableTextUses:5Used by:13
Symbol 10 GraphicUsed by:13 84 87 92 95 99
Symbol 11 GraphicUsed by:13 84 87 92 95 99
Symbol 12 EditableTextUses:5Used by:13
Symbol 13 ButtonUses:8 9 10 11 12Used by:17
Symbol 14 EditableTextUses:5Used by:17
Symbol 15 EditableTextUses:5Used by:17
Symbol 16 EditableTextUses:5Used by:17
Symbol 17 MovieClip {HighScoresScreen}Uses:4 7 13 14 15 16
Symbol 18 GraphicUsed by:19
Symbol 19 MovieClipUses:18Used by:20 21
Symbol 20 MovieClip {WaterShot}Uses:19
Symbol 21 MovieClip {FireShot}Uses:19
Symbol 22 GraphicUsed by:23
Symbol 23 MovieClip {PeacockBall}Uses:22
Symbol 24 GraphicUsed by:25
Symbol 25 MovieClip {ToadBall}Uses:24
Symbol 26 GraphicUsed by:27
Symbol 27 MovieClip {LizardBall}Uses:26
Symbol 28 GraphicUsed by:29
Symbol 29 MovieClip {BeeBall}Uses:28
Symbol 30 GraphicUsed by:31
Symbol 31 MovieClip {BerryBall}Uses:30
Symbol 32 GraphicUsed by:33
Symbol 33 MovieClip {WoodBall}Uses:32
Symbol 34 GraphicUsed by:35
Symbol 35 MovieClip {EnemyCube2}Uses:34
Symbol 36 GraphicUsed by:37
Symbol 37 MovieClip {EnemyDonut}Uses:36
Symbol 38 GraphicUsed by:39
Symbol 39 MovieClip {EnemyCube}Uses:38
Symbol 40 GraphicUsed by:41
Symbol 41 MovieClip {EnemyCone}Uses:40
Symbol 42 GraphicUsed by:43 62
Symbol 43 MovieClip {WaterTower}Uses:42Used by:62
Symbol 44 GraphicUsed by:45 61
Symbol 45 MovieClip {BloodTower}Uses:44Used by:61
Symbol 46 GraphicUsed by:47 60
Symbol 47 MovieClip {PoisonTower}Uses:46Used by:60
Symbol 48 GraphicUsed by:49 59
Symbol 49 MovieClip {GoldTower}Uses:48Used by:59
Symbol 50 GraphicUsed by:51 58
Symbol 51 MovieClip {FireTower}Uses:50Used by:58
Symbol 52 GraphicUsed by:53 57
Symbol 53 MovieClip {CannonTower}Uses:52Used by:57
Symbol 54 EditableTextUses:1Used by:69
Symbol 55 EditableTextUses:1Used by:69
Symbol 56 EditableTextUses:1Used by:69
Symbol 57 ButtonUses:53 52Used by:69
Symbol 58 ButtonUses:51 50Used by:69
Symbol 59 ButtonUses:49 48Used by:69
Symbol 60 ButtonUses:47 46Used by:69
Symbol 61 ButtonUses:45 44Used by:69
Symbol 62 ButtonUses:43 42Used by:69
Symbol 63 EditableTextUses:1Used by:69
Symbol 64 GraphicUsed by:68
Symbol 65 EditableTextUses:5Used by:68
Symbol 66 GraphicUsed by:68
Symbol 67 GraphicUsed by:68
Symbol 68 Button {RetryBtn}Uses:64 65 66 67Used by:69
Symbol 69 MovieClip {Menu}Uses:4 54 55 56 57 58 59 60 61 62 63 68
Symbol 70 GraphicUsed by:71
Symbol 71 MovieClip {CannonShot}Uses:70
Symbol 72 GraphicUsed by:75
Symbol 73 GraphicUsed by:74
Symbol 74 MovieClipUses:73Used by:75
Symbol 75 MovieClip {EnemyHealthMeter}Uses:72 74
Symbol 76 GraphicUsed by:77
Symbol 77 MovieClip {RangeCircle}Uses:76
Symbol 78 EditableTextUses:5Used by:88
Symbol 79 EditableTextUses:5Used by:88
Symbol 80 EditableTextUses:5Used by:88
Symbol 81 EditableTextUses:5Used by:88
Symbol 82 EditableTextUses:5Used by:84
Symbol 83 EditableTextUses:5Used by:84
Symbol 84 ButtonUses:8 82 10 11 83Used by:88
Symbol 85 EditableTextUses:5Used by:87
Symbol 86 EditableTextUses:5Used by:87
Symbol 87 ButtonUses:8 85 10 11 86Used by:88
Symbol 88 MovieClip {GameOverScreen}Uses:4 78 79 80 81 84 87
Symbol 89 EditableTextUses:5Used by:100
Symbol 90 EditableTextUses:5Used by:92
Symbol 91 EditableTextUses:5Used by:92
Symbol 92 ButtonUses:8 90 10 11 91Used by:100
Symbol 93 EditableTextUses:5Used by:95
Symbol 94 EditableTextUses:5Used by:95
Symbol 95 ButtonUses:8 93 10 11 94Used by:100
Symbol 96 EditableTextUses:5Used by:100
Symbol 97 EditableTextUses:5Used by:99
Symbol 98 EditableTextUses:5Used by:99
Symbol 99 ButtonUses:8 97 10 11 98Used by:100
Symbol 100 MovieClip {GameMenu}Uses:4 89 92 95 96 99
Symbol 101 BitmapUsed by:102
Symbol 102 GraphicUses:101Used by:103
Symbol 103 MovieClip {ExplosionParticle}Uses:102
Symbol 104 GraphicUsed by:Timeline

Instance Names

"backBtn"Symbol 17 MovieClip {HighScoresScreen} Frame 1Symbol 13 Button
"namesTxt"Symbol 17 MovieClip {HighScoresScreen} Frame 1Symbol 14 EditableText
"scoresTxt"Symbol 17 MovieClip {HighScoresScreen} Frame 1Symbol 15 EditableText
"statusTxt"Symbol 17 MovieClip {HighScoresScreen} Frame 1Symbol 16 EditableText
"scoreTxt"Symbol 69 MovieClip {Menu} Frame 1Symbol 54 EditableText
"lifeTxt"Symbol 69 MovieClip {Menu} Frame 1Symbol 55 EditableText
"goldTxt"Symbol 69 MovieClip {Menu} Frame 1Symbol 56 EditableText
"cannonBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 57 Button
"fireBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 58 Button
"lightningBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 59 Button
"poisonBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 60 Button
"bloodBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 61 Button
"moonBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 62 Button
"infoTxt"Symbol 69 MovieClip {Menu} Frame 1Symbol 63 EditableText
"mainMenuBtn"Symbol 69 MovieClip {Menu} Frame 1Symbol 68 Button {RetryBtn}
"top"Symbol 75 MovieClip {EnemyHealthMeter} Frame 1Symbol 74 MovieClip
"finalScoreTxt"Symbol 88 MovieClip {GameOverScreen} Frame 1Symbol 79 EditableText
"nameInput"Symbol 88 MovieClip {GameOverScreen} Frame 1Symbol 81 EditableText
"continueBtn"Symbol 88 MovieClip {GameOverScreen} Frame 1Symbol 84 Button
"submitScoreOnlineBtn"Symbol 88 MovieClip {GameOverScreen} Frame 1Symbol 87 Button
"playNowBtn"Symbol 100 MovieClip {GameMenu} Frame 1Symbol 92 Button
"moreGamesBtn"Symbol 100 MovieClip {GameMenu} Frame 1Symbol 95 Button
"highScoresBtn"Symbol 100 MovieClip {GameMenu} Frame 1Symbol 99 Button

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS3.




http://swfchan.com/5/20707/info.shtml
Created: 29/5 -2019 01:06:19 Last modified: 29/5 -2019 01:06:19 Server time: 21/12 -2024 17:12:17