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

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

TDGame.swf

This is the info page for
Flash #107287

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


Text
$100

Lives: 20

Level 1

You have now beaten the
demo level.

Click Anywhere to Play Again

You lost all your lives in
the demo level!

Click Anywhere to Try Again

ActionScript [AS3]

Section 1
//MainTimeline (TDGame_fla.MainTimeline) package TDGame_fla { import flash.events.*; import flash.display.*; import flash.text.*; import adobe.utils.*; import flash.accessibility.*; import flash.errors.*; import flash.external.*; import flash.filters.*; import flash.geom.*; import flash.media.*; import flash.net.*; import flash.printing.*; import flash.profiler.*; import flash.sampler.*; import flash.system.*; import flash.ui.*; import flash.utils.*; import flash.xml.*; public dynamic class MainTimeline extends MovieClip { public var txtMoney:TextField; public var txtLives:TextField; public var txtLevel:TextField; public var S:String; public var F:String; public var U:String; public var R:String; public var D:String; public var L:String; public var startDir:String; public var finDir:String; public var startCoord:int; public var lvlArray:Array; public var currentLvl:int; public var gameOver:Boolean; public var currentEnemy:int; public var enemyTime:int; public var enemyLimit:int; public var enemyArray:Array; public var enemiesLeft:int; public var money:int; public var lives:int; public var rangeCircle:Shape; public var roadHolder:Sprite; public var enemyHolder:Sprite; public function MainTimeline(){ addFrameScript(0, frame1, 4, frame5, 9, frame10); } public function startGame():void{ var _local1:int; while (_local1 < enemyArray[(currentLvl - 1)].length) { if (enemyArray[(currentLvl - 1)][_local1] != 0){ enemiesLeft++; }; _local1++; }; } public function makeRoad():void{ var _local2:*; var _local4:int; var _local1:int; var _local3:int; while (_local3 < lvlArray.length) { if (lvlArray[_local3] == 0){ _local2 = new EmptyBlock(); _local2.graphics.beginFill(0x333333); _local2.graphics.drawRect(0, 0, 25, 25); _local2.graphics.endFill(); addChild(_local2); _local2.x = ((_local3 - (_local1 * 22)) * 25); _local2.y = (_local1 * 25); } else { if (lvlArray[_local3] == 1){ _local2 = new Shape(); _local2.graphics.beginFill(0x111111); _local2.graphics.drawRect(0, 0, 25, 25); _local2.graphics.endFill(); _local2.x = ((_local3 - (_local1 * 22)) * 25); _local2.y = (_local1 * 25); roadHolder.addChild(_local2); } else { if ((lvlArray[_local3] is String)){ _local2 = new DirectBlock(lvlArray[_local3], ((_local3 - (_local1 * 22)) * 25), (_local1 * 25)); addChild(_local2); }; }; }; _local4 = 1; while (_local4 <= 16) { if (_local3 == ((_local4 * 22) - 1)){ _local1++; }; _local4++; }; _local3++; }; } public function makeTurret(_arg1:int, _arg2:int):void{ var _local3:Turret = new Turret(); _local3.x = (_arg1 + 12.5); _local3.y = (_arg2 + 12.5); addChild(_local3); } public function eFrame(_arg1:Event):void{ if (currentLvl > enemyArray.length){ gameOver = true; currentLvl = 1; currentEnemy = 0; enemyTime = 0; enemyLimit = 12; enemiesLeft = 0; removeEventListener(Event.ENTER_FRAME, eFrame); removeChild(roadHolder); gotoAndStop("win"); }; if (lives <= 0){ gameOver = true; currentLvl = 1; currentEnemy = 0; enemyTime = 0; enemyLimit = 12; enemiesLeft = 0; removeEventListener(Event.ENTER_FRAME, eFrame); removeChild(roadHolder); gotoAndStop("lose"); }; makeEnemies(); if (enemiesLeft == 0){ currentLvl++; currentEnemy = 0; startGame(); }; txtLevel.text = ("Level " + currentLvl); txtMoney.text = ("$" + money); txtLives.text = ("Lives: " + lives); } public function makeEnemies():void{ var _local1:int; var _local2:Enemy; if (enemyTime < enemyLimit){ enemyTime++; } else { _local1 = enemyArray[(currentLvl - 1)][currentEnemy]; if (_local1 != 0){ _local2 = new Enemy(_local1); enemyHolder.addChild(_local2); }; currentEnemy++; enemyTime = 0; }; } public function restartGame(_arg1:MouseEvent):void{ gotoAndStop(1); stage.removeEventListener(MouseEvent.CLICK, restartGame); } function frame1(){ stop(); S = "START"; F = "FINISH"; U = "UP"; R = "RIGHT"; D = "DOWN"; L = "LEFT"; lvlArray = new Array(); lvlArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, R, 1, 1, 1, 1, D, 0, 0, R, D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U, 1, 1, 1, L, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, S, 1, 1, 1, 1, 1, R, 1, 1, 1, U, R, 1, 1, U, 1, 0, 0, 0, 0, 0, 0, F, 1, 1, 1, 1, 1, L, D, 1, 1, L, D, 1, 1, 1, L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, R, 1, 1, 1, D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U, L, 0, 0, U, 1, 1, 1, 1, L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; currentLvl = 1; gameOver = false; currentEnemy = 0; enemyTime = 0; enemyLimit = 12; enemyArray = new Array(); enemyArray = [[2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [50], [5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 7, 6, 5, 7, 6, 5, 7, 6, 5, 7, 6, 5, 25], [50, 50, 50], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 35], [100, 100, 75], [100, 110, 120, 130, 140, 150]]; money = 100; lives = 20; rangeCircle = new Shape(); rangeCircle.graphics.beginFill(0x6600, 0.5); rangeCircle.graphics.drawCircle(12.5, 12.5, 100); rangeCircle.graphics.endFill(); roadHolder = new Sprite(); addChild(roadHolder); addEventListener(Event.ENTER_FRAME, eFrame); makeRoad(); enemyHolder = new Sprite(); addChild(enemyHolder); startGame(); } function frame5(){ stage.addEventListener(MouseEvent.CLICK, restartGame); } function frame10(){ stage.addEventListener(MouseEvent.CLICK, restartGame); } } }//package TDGame_fla
Section 2
//Bullet (Bullet) package { import flash.events.*; import flash.display.*; public class Bullet extends MovieClip { private var _root; public var target; public var damage:int; private var xSpeed:Number; private var ySpeed:Number; private var maxSpeed:Number;// = 15 public function Bullet(){ addEventListener(Event.ADDED, beginClass); addEventListener(Event.ENTER_FRAME, eFrame); } private function beginClass(_arg1:Event):void{ _root = MovieClip(root); this.graphics.beginFill(0xFF0000); this.graphics.drawCircle(0, 0, 2.5); this.graphics.endFill(); } private function eFrame(_arg1:Event):void{ var _local2:Number = ((target.y + 12.5) - this.y); var _local3:Number = ((target.x + 12.5) - this.x); var _local4:Number = Math.atan2(_local2, _local3); ySpeed = (Math.sin(_local4) * maxSpeed); xSpeed = (Math.cos(_local4) * maxSpeed); this.x = (this.x + xSpeed); this.y = (this.y + ySpeed); if (this.hitTestObject(target)){ target.health = (target.health - damage); destroyThis(); }; if ((((target == null)) || ((_root.gameOver == true)))){ destroyThis(); }; } public function destroyThis():void{ this.removeEventListener(Event.ENTER_FRAME, eFrame); MovieClip(this.parent).removeChild(this); } } }//package
Section 3
//DirectBlock (DirectBlock) package { import flash.events.*; import flash.display.*; import flash.geom.*; public class DirectBlock extends MovieClip { private var _root:MovieClip; private var directType:String; public function DirectBlock(_arg1:String, _arg2:int, _arg3:int){ directType = _arg1; this.addEventListener(Event.ADDED, beginClass); this.addEventListener(Event.ENTER_FRAME, eFrame); this.x = _arg2; this.y = _arg3; } private function beginClass(_arg1:Event):void{ _root = MovieClip(root); this.graphics.beginFill(0x111111); this.graphics.drawRect(0, 0, 25, 25); this.graphics.endFill(); if (directType == "START"){ if (this.x == 0){ _root.startDir = "RIGHT"; _root.startCoord = this.y; } else { if (this.y == 0){ _root.startDir = "DOWN"; _root.startCoord = this.x; } else { if (this.x == 525){ _root.startDir = "LEFT"; _root.startCoord = this.y; } else { if (this.y == 275){ _root.startDir = "UP"; _root.startCoord = this.x; }; }; }; }; } else { if (directType == "FINISH"){ if (this.x == 0){ _root.finDir = "LEFT"; } else { if (this.y == 0){ _root.finDir = "UP"; } else { if (this.x == 525){ _root.finDir = "RIGHT"; } else { if (this.y == 275){ _root.finDir = "DOWN"; }; }; }; }; }; }; } private function eFrame(_arg1:Event):void{ var _local2:int; var _local3:*; if (_root.gameOver == true){ this.removeEventListener(Event.ENTER_FRAME, eFrame); MovieClip(this.parent).removeChild(this); }; if (((!((directType == "START"))) && (!((directType == "FINISH"))))){ _local2 = 0; while (_local2 < _root.enemyHolder.numChildren) { _local3 = _root.enemyHolder.getChildAt(_local2); if ((((((((this.x >= (_local3.x - (_local3.width * 0.5)))) && ((this.x <= (_local3.x + (_local3.width * 0.5)))))) && ((this.y >= (_local3.y - (_local3.height * 0.5)))))) && ((this.y <= (_local3.y + (_local3.height * 0.5)))))){ if (directType == "UP"){ _local3.xSpeed = 0; _local3.ySpeed = -(_local3.maxSpeed); } else { if (directType == "RIGHT"){ _local3.xSpeed = _local3.maxSpeed; _local3.ySpeed = 0; } else { if (directType == "DOWN"){ _local3.xSpeed = 0; _local3.ySpeed = _local3.maxSpeed; } else { if (directType == "LEFT"){ _local3.xSpeed = -(_local3.maxSpeed); _local3.ySpeed = 0; }; }; }; }; }; _local2++; }; }; } } }//package
Section 4
//EmptyBlock (EmptyBlock) package { import flash.events.*; import flash.display.*; public class EmptyBlock extends MovieClip { private var _root:MovieClip; public function EmptyBlock(){ this.addEventListener(Event.ADDED, beginClass); this.addEventListener(Event.ENTER_FRAME, eFrameEvents); } private function beginClass(_arg1:Event):void{ _root = MovieClip(root); this.buttonMode = true; this.addEventListener(MouseEvent.MOUSE_OVER, thisMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, thisMouseOut); this.addEventListener(MouseEvent.CLICK, thisClick); } private function eFrameEvents(_arg1:Event):void{ if (_root.gameOver){ this.removeEventListener(Event.ENTER_FRAME, eFrameEvents); this.removeEventListener(MouseEvent.MOUSE_OVER, thisMouseOver); this.removeEventListener(MouseEvent.MOUSE_OUT, thisMouseOut); this.removeEventListener(MouseEvent.CLICK, thisClick); MovieClip(this.parent).removeChild(this); }; } private function thisMouseOver(_arg1:MouseEvent):void{ this.graphics.beginFill(0x6600); this.graphics.drawRect(0, 0, 25, 25); this.graphics.endFill(); _root.rangeCircle.x = this.x; _root.rangeCircle.y = this.y; _root.addChild(_root.rangeCircle); } private function thisMouseOut(_arg1:MouseEvent):void{ this.graphics.beginFill(0x333333); this.graphics.drawRect(0, 0, 25, 25); this.graphics.endFill(); _root.removeChild(_root.rangeCircle); } private function thisClick(_arg1:MouseEvent):void{ if (_root.money >= 20){ _root.makeTurret(this.x, this.y); this.buttonMode = false; this.graphics.beginFill(0x333333); this.graphics.drawRect(0, 0, 25, 25); this.graphics.endFill(); this.removeEventListener(MouseEvent.MOUSE_OVER, thisMouseOver); this.removeEventListener(MouseEvent.MOUSE_OUT, thisMouseOut); this.removeEventListener(MouseEvent.CLICK, thisClick); _root.money = (_root.money - 20); _root.removeChild(_root.rangeCircle); }; } } }//package
Section 5
//Enemy (Enemy) package { import flash.events.*; import flash.display.*; public class Enemy extends MovieClip { private var _root:MovieClip; public var xSpeed:int; public var ySpeed:int; public var maxSpeed:int;// = 3 public var health:int; public var level:int; public function Enemy(_arg1:int){ this.addEventListener(Event.ADDED, beginClass); this.addEventListener(Event.ENTER_FRAME, eFrameEvents); level = _arg1; } private function beginClass(_arg1:Event):void{ _root = MovieClip(root); health = (level * 5); if (_root.startDir == "UP"){ this.y = 300; this.x = _root.startCoord; this.xSpeed = 0; this.ySpeed = -(maxSpeed); } else { if (_root.startDir == "RIGHT"){ this.x = -25; this.y = _root.startCoord; this.xSpeed = maxSpeed; this.ySpeed = 0; } else { if (_root.startDir == "DOWN"){ this.y = -25; this.x = _root.startCoord; this.xSpeed = 0; this.ySpeed = maxSpeed; } else { if (_root.startDir == "LEFT"){ this.x = 550; this.y = _root.startCoord; this.xSpeed = -(maxSpeed); this.ySpeed = 0; }; }; }; }; this.graphics.beginFill(0xFF0000); this.graphics.drawCircle(12.5, 12.5, 5); this.graphics.endFill(); } private function eFrameEvents(_arg1:Event):void{ this.x = (this.x + xSpeed); this.y = (this.y + ySpeed); if (_root.finDir == "UP"){ if (this.y <= -25){ destroyThis(); _root.lives--; }; } else { if (_root.finDir == "RIGHT"){ if (this.x >= 550){ destroyThis(); _root.lives--; }; } else { if (_root.finDir == "DOWN"){ if (this.y >= 300){ destroyThis(); _root.lives--; }; } else { if (_root.startDir == "LEFT"){ if (this.x <= 0){ destroyThis(); _root.lives--; }; }; }; }; }; if (_root.gameOver){ destroyThis(); }; if (health <= 0){ destroyThis(); _root.money = (_root.money + (level / 2)); }; } public function destroyThis():void{ this.removeEventListener(Event.ENTER_FRAME, eFrameEvents); this.parent.removeChild(this); _root.enemiesLeft--; } } }//package
Section 6
//Turret (Turret) package { import flash.events.*; import flash.display.*; public class Turret extends MovieClip { private var _root:MovieClip; private var angle:Number; private var radiansToDegrees:Number;// = 57.2957795130823 private var damage:int;// = 1 private var range:int;// = 100 private var enTarget; private var cTime:int;// = 0 private var reloadTime:int;// = 6 private var loaded:Boolean;// = true public function Turret(){ this.addEventListener(Event.ADDED, beginClass); this.addEventListener(Event.ENTER_FRAME, eFrameEvents); this.addEventListener(MouseEvent.MOUSE_OVER, thisMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, thisMouseOut); } private function beginClass(_arg1:Event):void{ _root = MovieClip(root); this.graphics.beginFill(0x222222); this.graphics.drawCircle(0, 0, 12.5); this.graphics.endFill(); this.graphics.beginFill(0x444444); this.graphics.drawRect(-2.5, -2, 5, 20); this.graphics.endFill(); } private function eFrameEvents(_arg1:Event):void{ var _local4:*; var _local5:Bullet; var _local2:Number = range; enTarget = null; var _local3:int = (_root.enemyHolder.numChildren - 1); while (_local3 >= 0) { _local4 = _root.enemyHolder.getChildAt(_local3); if (Math.sqrt((Math.pow((_local4.y - y), 2) + Math.pow((_local4.x - x), 2))) < _local2){ enTarget = _local4; }; _local3--; }; if (enTarget != null){ this.rotation = (((Math.atan2((enTarget.y - y), (enTarget.x - x)) / Math.PI) * 180) - 90); if (loaded){ loaded = false; _local5 = new Bullet(); _local5.x = this.x; _local5.y = this.y; _local5.target = enTarget; _local5.damage = damage; _root.addChild(_local5); }; }; if (!loaded){ cTime++; if (cTime == reloadTime){ loaded = true; cTime = 0; }; }; if (_root.gameOver){ this.removeEventListener(Event.ENTER_FRAME, eFrameEvents); MovieClip(this.parent).removeChild(this); }; } private function thisMouseOver(_arg1:MouseEvent):void{ _root.rangeCircle.x = (this.x - 12.5); _root.rangeCircle.y = (this.y - 12.5); _root.addChild(_root.rangeCircle); } private function thisMouseOut(_arg1:MouseEvent):void{ _root.removeChild(_root.rangeCircle); } } }//package

Library Items

Symbol 1 FontUsed by:2 3 4 7 9
Symbol 2 EditableTextUses:1Used by:Timeline
Symbol 3 EditableTextUses:1Used by:Timeline
Symbol 4 EditableTextUses:1Used by:Timeline
Symbol 5 FontUsed by:6 8
Symbol 6 TextUses:5Used by:Timeline
Symbol 7 TextUses:1Used by:Timeline
Symbol 8 TextUses:5Used by:Timeline
Symbol 9 TextUses:1Used by:Timeline

Instance Names

"txtMoney"Frame 1Symbol 2 EditableText
"txtLives"Frame 1Symbol 3 EditableText
"txtLevel"Frame 1Symbol 4 EditableText

Special Tags

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

Labels

"win"Frame 5
"lose"Frame 10




http://swfchan.com/22/107287/info.shtml
Created: 16/3 -2019 14:59:19 Last modified: 16/3 -2019 14:59:19 Server time: 18/04 -2024 01:19:33