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

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

game2.swf

This is the info page for
Flash #94497

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


Text
Congratulations, You Won!

You Lost... Better Luck Next Time!

ActionScript [AS3]

Section 1
//MainTimeline (Game2_fla.MainTimeline) package Game2_fla { import flash.events.*; import flash.display.*; import flash.utils.*; 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.text.*; import flash.ui.*; import flash.xml.*; public dynamic class MainTimeline extends MovieClip { public var acceleration; public var speed:int; public var goingUp:Boolean; public var goingDown:Boolean; public var goingLeft:Boolean; public var goingRight:Boolean; public var Xvel; public var Yvel; public var rot; public var player:Player; public var canFire:Boolean; public var timer:Timer; public var pBullets:Array; public var eBullets:Array; public var bulletIndex; public var eBulletIndex; public var ind:int; public var enemy:Enemy; public var enemyFire:Timer; public var scoreBar:ScoreBar; public var gameOver:Boolean; public var playerWon:Boolean; public function MainTimeline(){ addFrameScript(0, frame1); } public function enemyShoot(_arg1:TimerEvent){ eBullets[eBulletIndex].fireBullet(enemy.x, enemy.y, (90 + ((Math.atan2((player.y - enemy.y), (player.x - enemy.x)) / Math.PI) * 180))); eBulletIndex++; if (eBulletIndex > 4){ eBulletIndex = 0; }; } public function fire(_arg1:MouseEvent){ if (canFire){ pBullets[bulletIndex].fireBullet(player.x, player.y, player.rotation); canFire = false; timer.start(); bulletIndex++; if (bulletIndex > 2){ bulletIndex = 0; }; }; } public function orientPlayer(_arg1:MouseEvent){ player.rotation = (90 + ((Math.atan2((_arg1.stageY - player.y), (_arg1.stageX - player.x)) / Math.PI) * 180)); } public function perFrame(_arg1:Event){ if (!gameOver){ if (goingUp){ Yvel = (Yvel - acceleration); } else { if (Yvel < 0){ Yvel = (Yvel + 1); }; }; if (goingDown){ Yvel = (Yvel + acceleration); } else { if (Yvel > 0){ Yvel = (Yvel - 1); }; }; if (goingLeft){ Xvel = (Xvel - acceleration); } else { if (Xvel < 0){ Xvel = (Xvel + 1); }; }; if (goingRight){ Xvel = (Xvel + acceleration); } else { if (Xvel > 0){ Xvel = (Xvel - 1); }; }; if (Yvel > speed){ Yvel = speed; }; if (Yvel < -(speed)){ Yvel = -(speed); }; if (Xvel > speed){ Xvel = speed; }; if (Xvel < -(speed)){ Xvel = -(speed); }; player.y = (player.y + Yvel); player.x = (player.x + Xvel); if (player.x < 0){ player.x = 0; Xvel = 0; }; if (player.x > 555){ player.x = 555; Xvel = 0; }; if (player.y < 0){ player.y = 0; Yvel = 0; }; if (player.y > 410){ player.y = 410; Yvel = 0; }; ind = 0; while (ind < pBullets.length) { pBullets[ind].update(); if (((pBullets[ind].visible) && ((Math.sqrt((Math.pow(Math.abs((enemy.x - pBullets[ind].x)), 2) + Math.pow(Math.abs((enemy.y - pBullets[ind].y)), 2))) < (pBullets[ind].radius + enemy.radius))))){ enemyHit(); pBullets[ind].killBullet(); }; ind++; }; ind = 0; while (ind < eBullets.length) { eBullets[ind].update(); if (((eBullets[ind].visible) && ((Math.sqrt((Math.pow(Math.abs((player.x - eBullets[ind].x)), 2) + Math.pow(Math.abs((player.y - eBullets[ind].y)), 2))) < (eBullets[ind].radius + player.radius))))){ playerHit(); eBullets[ind].killBullet(); }; ind++; }; player.update(); enemy.update(); enemy.orient(player.x, player.y); if (Math.abs(scoreBar.getAdvantage()) >= scoreBar.getScoreToWin()){ gameOver = true; if (scoreBar.getAdvantage() > 0){ playerWon = true; gameCompleted(); } else { playerWon = false; gameCompleted(); }; }; }; } public function gameCompleted(){ var _local2:WinMessage; var _local3:LoseMessage; if (playerWon){ _local2 = new WinMessage(); _local2.x = 277; _local2.y = 205; stage.addChild(_local2); stage.setChildIndex(_local2, (stage.numChildren - 1)); } else { _local3 = new LoseMessage(); _local3.x = 277; _local3.y = 205; stage.addChild(_local3); stage.setChildIndex(_local3, (stage.numChildren - 1)); }; var _local1:Timer = new Timer(3000, 1); _local1.addEventListener(TimerEvent.TIMER, doExit); _local1.start(); } public function doExit(_arg1:TimerEvent){ exitGame(); } public function exitGame(){ } public function enemyHit(){ enemy.wasHit(); scoreBar.greenPoint(); } public function playerHit(){ player.wasHit(); scoreBar.redPoint(); } public function doMove(_arg1:KeyboardEvent){ switch (_arg1.keyCode){ case Keyboard.RIGHT: goingRight = true; break; case Keyboard.LEFT: goingLeft = true; break; case Keyboard.UP: goingUp = true; break; case Keyboard.DOWN: goingDown = true; break; }; } public function reload(_arg1:TimerEvent):void{ canFire = true; } public function stopMove(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case Keyboard.RIGHT: goingRight = false; break; case Keyboard.LEFT: goingLeft = false; break; case Keyboard.UP: goingUp = false; break; case Keyboard.DOWN: goingDown = false; break; }; } function frame1(){ stop(); acceleration = 1; speed = 10; goingUp = false; goingDown = false; goingLeft = false; goingRight = false; Xvel = 0; Yvel = 0; rot = 0; player = new Player(); player.createPlayer(100, 100); canFire = true; timer = new Timer(500, 1); stage.addChild(player); pBullets = new Array(); eBullets = new Array(); bulletIndex = 0; eBulletIndex = 0; enemy = new Enemy(); enemy.createEnemy(); stage.addChild(enemy); enemy.changeTarget(); enemyFire = new Timer(400, 0); enemyFire.start(); scoreBar = new ScoreBar(); scoreBar.resetBar(); scoreBar.x = 277; scoreBar.y = 40; stage.addChild(scoreBar); gameOver = false; playerWon = false; ind = 0; while (ind < 3) { pBullets.push(new BulletPlayer()); stage.addChild(pBullets[ind]); ind++; }; ind = 0; while (ind < 5) { eBullets.push(new BulletEnemy()); stage.addChild(eBullets[ind]); ind++; }; stage.setChildIndex(player, (stage.numChildren - 1)); stage.setChildIndex(enemy, (stage.numChildren - 1)); stage.addEventListener(KeyboardEvent.KEY_DOWN, doMove); stage.addEventListener(KeyboardEvent.KEY_UP, stopMove); stage.addEventListener(Event.ENTER_FRAME, perFrame); stage.addEventListener(MouseEvent.MOUSE_MOVE, orientPlayer); stage.addEventListener(MouseEvent.CLICK, fire); timer.addEventListener(TimerEvent.TIMER, reload); enemyFire.addEventListener(TimerEvent.TIMER, enemyShoot); } } }//package Game2_fla
Section 2
//BulletEnemy (BulletEnemy) package { import flash.display.*; public dynamic class BulletEnemy extends MovieClip { public var radius; public var yVel; public var xVel; public var speed; public function BulletEnemy(){ addFrameScript(0, frame1); } public function fireBullet(_arg1:int, _arg2:int, _arg3){ this.x = _arg1; this.y = _arg2; yVel = (speed * Math.sin((((_arg3 - 90) * Math.PI) / 180))); xVel = (speed * Math.cos((((_arg3 - 90) * Math.PI) / 180))); this.visible = true; } public function update(){ checkBounds(); this.x = (this.x + xVel); this.y = (this.y + yVel); rotation = (rotation + 18); } public function checkBounds(){ if ((((this.x < 0)) || ((this.y < 0)))){ killBullet(); } else { if ((((x > 555)) || ((y > 410)))){ killBullet(); }; }; } public function killBullet(){ this.visible = false; x = -10; y = -10; xVel = 0; yVel = 0; } public function test():String{ return (this.visible.toString()); } function frame1(){ radius = 2; yVel = 0; xVel = 0; speed = 10; x = -10; y = -10; stop(); } } }//package
Section 3
//BulletPlayer (BulletPlayer) package { import flash.display.*; public dynamic class BulletPlayer extends MovieClip { public var radius; public var yVel; public var xVel; public var speed; public function BulletPlayer(){ addFrameScript(0, frame1, 1, frame2); } public function fireBullet(_arg1:int, _arg2:int, _arg3){ this.x = _arg1; this.y = _arg2; yVel = (speed * Math.sin((((_arg3 - 90) * Math.PI) / 180))); xVel = (speed * Math.cos((((_arg3 - 90) * Math.PI) / 180))); this.visible = true; } public function update(){ checkBounds(); this.x = (this.x + xVel); this.y = (this.y + yVel); rotation = (rotation + 18); } public function checkBounds(){ if ((((this.x < 0)) || ((this.y < 0)))){ killBullet(); } else { if ((((x > 555)) || ((y > 410)))){ killBullet(); }; }; } public function killBullet(){ this.visible = false; x = -10; y = -10; xVel = 0; yVel = 0; } public function test():String{ return (this.visible.toString()); } function frame1(){ radius = 2; yVel = 0; xVel = 0; speed = 15; x = -10; y = -10; stop(); } function frame2(){ gotoAndPlay(1); } } }//package
Section 4
//Enemy (Enemy) package { import flash.display.*; public dynamic class Enemy extends MovieClip { public var cannon:MovieClip; public var radius; public var speed; public var targetX:int; public var targetY:int; public var ratio; public var hitFrameCount; public var hitFramePos; public var hitFlashCount; public function Enemy(){ addFrameScript(0, frame1); } public function createEnemy():void{ x = 450; y = 300; } public function changeTarget():void{ targetX = ((555 / 2) + ((Math.sin(((Math.random() * Math.PI) / 2)) * ((Math.ceil((Math.random() * 2)) * 2) - 3)) * ((555 / 2) - 20))); targetY = ((410 / 2) + ((Math.sin(((Math.random() * Math.PI) / 2)) * ((Math.ceil((Math.random() * 2)) * 2) - 3)) * ((410 / 2) - 20))); } public function update():void{ ratio = (Math.max(Math.abs((x - targetX)), Math.abs((y - targetY))) / speed); x = (x + ((targetX - x) / ratio)); y = (y + ((targetY - y) / ratio)); rotation = (rotation + 3); if ((((Math.abs((y - targetY)) < speed)) && ((Math.abs((x - targetX)) < speed)))){ changeTarget(); }; if (hitFlashCount > 0){ if (hitFramePos == 0){ visible = !(visible); hitFramePos = hitFrameCount; hitFlashCount--; } else { hitFramePos--; }; } else { visible = true; }; } public function orient(_arg1, _arg2):void{ cannon.rotation = ((90 + ((Math.atan2((_arg2 - y), (_arg1 - x)) / Math.PI) * 180)) - rotation); } public function wasHit(){ hitFlashCount = 6; } function frame1(){ stop(); radius = 20; speed = 8; targetX = 449; targetY = 331; ratio = 0; hitFrameCount = 0; hitFramePos = hitFrameCount; hitFlashCount = 0; } } }//package
Section 5
//LoseMessage (LoseMessage) package { import flash.display.*; public dynamic class LoseMessage extends MovieClip { } }//package
Section 6
//Player (Player) package { import flash.display.*; public dynamic class Player extends MovieClip { public var radius; public var hitFrameCount; public var hitFramePos; public var hitFlashCount; public function Player(){ addFrameScript(0, frame1); } public function createPlayer(_arg1:int, _arg2:int){ this.x = _arg1; this.y = _arg2; this.visible = true; } public function update(){ if (hitFlashCount > 0){ if (hitFramePos == 0){ visible = !(visible); hitFramePos = hitFrameCount; hitFlashCount--; } else { hitFramePos--; }; } else { visible = true; }; } public function wasHit(){ hitFlashCount = 6; } function frame1(){ radius = 15; hitFrameCount = 0; hitFramePos = hitFrameCount; hitFlashCount = 0; } } }//package
Section 7
//ScoreBar (ScoreBar) package { import flash.display.*; public dynamic class ScoreBar extends MovieClip { public var green:MovieClip; public var red:MovieClip; public var scoreToWin:int; public var playerAdvantage:int; public function ScoreBar(){ addFrameScript(0, frame1); } public function getAdvantage():int{ return (playerAdvantage); } public function getScoreToWin():int{ return (scoreToWin); } public function resetBar(){ red.visible = false; green.visible = false; } public function greenPoint(){ playerAdvantage++; adjustBar(); } public function redPoint(){ playerAdvantage--; adjustBar(); } public function adjustBar(){ if (playerAdvantage == 0){ resetBar(); } else { if (playerAdvantage < 0){ red.visible = true; red.width = ((98 / scoreToWin) * -(playerAdvantage)); } else { if (playerAdvantage > 0){ green.visible = true; green.width = ((98 / scoreToWin) * playerAdvantage); green.x = -(green.width); }; }; }; } function frame1(){ stop(); scoreToWin = 10; playerAdvantage = 0; } } }//package
Section 8
//WinMessage (WinMessage) package { import flash.display.*; public dynamic class WinMessage extends MovieClip { } }//package

Library Items

Symbol 1 GraphicUsed by:4 14
Symbol 2 FontUsed by:3 13
Symbol 3 TextUses:2Used by:4
Symbol 4 MovieClip {WinMessage}Uses:1 3
Symbol 5 GraphicUsed by:6
Symbol 6 MovieClipUses:5Used by:10
Symbol 7 GraphicUsed by:8
Symbol 8 MovieClipUses:7Used by:10
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClip {ScoreBar}Uses:6 8 9
Symbol 11 GraphicUsed by:12
Symbol 12 MovieClip {Player}Uses:11
Symbol 13 TextUses:2Used by:14
Symbol 14 MovieClip {LoseMessage}Uses:1 13
Symbol 15 GraphicUsed by:16
Symbol 16 MovieClipUses:15Used by:18
Symbol 17 GraphicUsed by:18
Symbol 18 MovieClip {Enemy}Uses:16 17
Symbol 19 GraphicUsed by:21
Symbol 20 GraphicUsed by:21
Symbol 21 MovieClip {BulletPlayer}Uses:19 20
Symbol 22 GraphicUsed by:24
Symbol 23 GraphicUsed by:24
Symbol 24 MovieClip {BulletEnemy}Uses:22 23
Symbol 25 GraphicUsed by:Timeline

Instance Names

"red"Symbol 10 MovieClip {ScoreBar} Frame 1Symbol 6 MovieClip
"green"Symbol 10 MovieClip {ScoreBar} Frame 1Symbol 8 MovieClip
"cannon"Symbol 18 MovieClip {Enemy} Frame 1Symbol 16 MovieClip

Special Tags

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




http://swfchan.com/19/94497/info.shtml
Created: 26/3 -2019 04:29:11 Last modified: 26/3 -2019 04:29:11 Server time: 29/04 -2024 22:27:44