Section 1
//ag_intro_mc_6 (PaddleBall_fla.ag_intro_mc_6)
package PaddleBall_fla {
import flash.display.*;
public dynamic class ag_intro_mc_6 extends MovieClip {
public function ag_intro_mc_6(){
addFrameScript(0, frame1, 217, frame218);
}
function frame218(){
PaddleBall(root).nextFrame();
}
function frame1(){
PaddleBall(root).stop();
gotoAndPlay(2);
}
}
}//package PaddleBall_fla
Section 2
//instructionsgraphic_22 (PaddleBall_fla.instructionsgraphic_22)
package PaddleBall_fla {
import flash.events.*;
import flash.display.*;
public dynamic class instructionsgraphic_22 extends MovieClip {
public var noInstructions:MovieClip;
public var playButton:SimpleButton;
public function instructionsgraphic_22(){
addFrameScript(0, frame1);
}
public function check(_arg1:MouseEvent){
if (noInstructions.currentFrame == 1){
noInstructions.gotoAndStop(2);
PaddleBall(root).showInstructions = false;
} else {
noInstructions.gotoAndStop(1);
PaddleBall(root).showInstructions = true;
};
}
function frame1(){
noInstructions.addEventListener(MouseEvent.CLICK, check);
noInstructions.buttonMode = true;
}
}
}//package PaddleBall_fla
Section 3
//jgamesgraphic_15 (PaddleBall_fla.jgamesgraphic_15)
package PaddleBall_fla {
import flash.display.*;
public dynamic class jgamesgraphic_15 extends MovieClip {
public var moreGames:SimpleButton;
public function jgamesgraphic_15(){
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package PaddleBall_fla
Section 4
//loadingBar_4 (PaddleBall_fla.loadingBar_4)
package PaddleBall_fla {
import flash.display.*;
import flash.text.*;
public dynamic class loadingBar_4 extends MovieClip {
public var progressText:TextField;
public function loadingBar_4(){
addFrameScript(0, frame1, 9, frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
}
}//package PaddleBall_fla
Section 5
//NoInstructions_24 (PaddleBall_fla.NoInstructions_24)
package PaddleBall_fla {
import flash.display.*;
public dynamic class NoInstructions_24 extends MovieClip {
public function NoInstructions_24(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package PaddleBall_fla
Section 6
//PaddleGraphic_40 (PaddleBall_fla.PaddleGraphic_40)
package PaddleBall_fla {
import flash.display.*;
public dynamic class PaddleGraphic_40 extends MovieClip {
public var loader:MovieClip;
public function PaddleGraphic_40(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package PaddleBall_fla
Section 7
//powerupgraphic_33 (PaddleBall_fla.powerupgraphic_33)
package PaddleBall_fla {
import flash.display.*;
public dynamic class powerupgraphic_33 extends MovieClip {
public var p:MovieClip;
}
}//package PaddleBall_fla
Section 8
//powerupgraphic2_34 (PaddleBall_fla.powerupgraphic2_34)
package PaddleBall_fla {
import flash.display.*;
public dynamic class powerupgraphic2_34 extends MovieClip {
public function powerupgraphic2_34(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package PaddleBall_fla
Section 9
//rankBackgroundgraphic_19 (PaddleBall_fla.rankBackgroundgraphic_19)
package PaddleBall_fla {
import flash.display.*;
import flash.text.*;
public dynamic class rankBackgroundgraphic_19 extends MovieClip {
public var menuButton:SimpleButton;
public var rankTxt:TextField;
}
}//package PaddleBall_fla
Section 10
//AdHolder (AdHolder)
package {
import flash.display.*;
public dynamic class AdHolder extends MovieClip {
}
}//package
Section 11
//Ball (Ball)
package {
import flash.display.*;
public dynamic class Ball extends MovieClip {
}
}//package
Section 12
//BasicButton (BasicButton)
package {
import flash.display.*;
public dynamic class BasicButton extends SimpleButton {
}
}//package
Section 13
//Bounce (Bounce)
package {
import flash.media.*;
public dynamic class Bounce extends Sound {
}
}//package
Section 14
//Cannon (Cannon)
package {
import flash.events.*;
import flash.display.*;
public class Cannon extends MovieClip {
private var animstep:Number;// = 0
private var animation:Array;
public function Cannon(){
animation = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40);
animstep = 0;
super();
addFrameScript(19, frame20);
addEventListener(Event.ENTER_FRAME, update);
}
function frame20(){
PaddleBall(root).newBall(this.x, this.y);
}
function update(_arg1:Event){
if (PaddleBall(root).paused == false){
animstep = (animstep + (PaddleBall(root).timePassed / 60));
if (animstep > animation.length){
removeEventListener(Event.ENTER_FRAME, update);
parent.removeChild(this);
};
gotoAndStop(animation[Math.floor(animstep)]);
};
}
}
}//package
Section 15
//Credits (Credits)
package {
import flash.display.*;
public dynamic class Credits extends MovieClip {
public function Credits(){
addFrameScript(58, frame59);
}
function frame59(){
stop();
}
}
}//package
Section 16
//EasyMode (EasyMode)
package {
import flash.display.*;
public dynamic class EasyMode extends SimpleButton {
}
}//package
Section 17
//EndScoreDisplay (EndScoreDisplay)
package {
import flash.display.*;
import flash.text.*;
public dynamic class EndScoreDisplay extends MovieClip {
public var score:TextField;
}
}//package
Section 18
//HardMode (HardMode)
package {
import flash.display.*;
public dynamic class HardMode extends SimpleButton {
}
}//package
Section 19
//Instructions (Instructions)
package {
import flash.display.*;
public dynamic class Instructions extends MovieClip {
public var instructions:MovieClip;
public function Instructions(){
addFrameScript(44, frame45);
}
function frame45(){
stop();
}
}
}//package
Section 20
//Jgames (Jgames)
package {
import flash.display.*;
public dynamic class Jgames extends MovieClip {
public var jgames:MovieClip;
public function Jgames(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package
Section 21
//LB (LB)
package {
import flash.display.*;
public dynamic class LB extends MovieClip {
}
}//package
Section 22
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package
Section 23
//NormalMode (NormalMode)
package {
import flash.display.*;
public dynamic class NormalMode extends SimpleButton {
}
}//package
Section 24
//Paddle (Paddle)
package {
import flash.display.*;
public dynamic class Paddle extends MovieClip {
public var paddle:MovieClip;
}
}//package
Section 25
//PaddleBall (PaddleBall)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import flash.utils.*;
import flash.ui.*;
import flash.geom.*;
import flash.net.*;
public dynamic class PaddleBall extends MovieClip {
private const paddleY:Number = 380;
private const paddleWidth:Number = 90;
private const wallRight:Number = 535;
private const wallLeft:Number = 15;
private const wallTop:Number = -10;
private const paddleHeight:Number = 15;
private const paddleCurve:Number = 0.005;
private var reloadTime:Number;// = 1
private var paddle2:Paddle;
private var pScore:PScore;
public var bar:MovieClip;
private var fps_txt:TextField;
private var powerups:Array;
private var music:Sound;
public var rank:String;// = ""
public var skala:MovieClip;
private var bf:BlurFilter;
private var cannonTimer:Timer;
private var endScoreDisplay:EndScoreDisplay;
private var bricks:Array;
private var powerup:Powerup;
private var balls:Array;
private var sfxTransform:SoundTransform;
private var myContextMenu:ContextMenu;
private var j:int;
private var bm:Bitmap;
private var i:int;
private var powerupsNum:int;// = 0
private var paddleRect:Rectangle;
private var endScore:Number;// = 0
private var slowMotionTimer:Timer;
private var bounce:Bounce;
private var newBalls:Array;
public var jgames:Jgames;
private var score:Number;// = 0
public var credits:Credits;
private var lastTime:uint;
private var rankBackground:RankBackground;
private var lastSoundTime:Number;// = 0
private var shots:Array;
public var easyMode:EasyMode;
private var musicTransform:SoundTransform;
private var shotReady:Boolean;// = true
private var powerupTimer:Timer;
private var time:int;
private var ammo:int;// = 0
private var ballsInPlayNum:int;// = 0
private var ballWaveNum:int;// = 0
public var mochib:MovieClip;
private var mouseDown:Boolean;// = false
private var fps:int;
private var fpsArray:Array;
private var colorChange:Array;
private var cannon:Cannon;
private var shot:Shot;
private var slowMotion:Boolean;// = false
private var musicChannel:SoundChannel;
private var colorNum:int;// = 0
public var normalMode:NormalMode;
public var gameMessage2:TextField;
private var soundChannel:SoundChannel;
public var hardMode:HardMode;
public var paused:Boolean;// = false
public var loadingBar:MovieClip;
public var showInstructions:Boolean;// = true
private var cmf:ColorMatrixFilter;
private var newBallNum:int;// = 0
private var cannonX:Number;// = 50
private var num1:Number;// = 0.1
private var num3:Number;// = 1
private var num4:Number;// = 0.4
private var colors:Array;
private var paddle:Paddle;
private var num2:Number;// = 0.9
private var bmd:BitmapData;
private var muted:Boolean;// = false
private var ballsInPlay:Array;
private var paddleRect2:Rectangle;
private var powerupsTime:Array;
public var playButton:SimpleButton;
private var reload:Number;// = 0
private var averageFps:int;// = 0
public var firstTime:Boolean;// = true
private var prevTime:int;// = 0
private var colorChangeNum:int;// = 0
public var timePassed:Number;// = 1
public var holder:MovieClip;
public var gameMessage:TextField;
public var difficulty:String;// = "easy"
public var instructions:Instructions;
private var waveTimer:Timer;
private var scoreDisplay:Number;// = 0
private var cScoreDisplay:Number;// = 0
public var loadingBar1:MovieClip;
private var ballWaves:Array;
private var cScore:Number;// = 0
private var closestBall;// = null
private var ball:MovieClip;
public function PaddleBall(){
firstTime = true;
balls = new Array();
difficulty = "easy";
rank = "";
showInstructions = true;
prevTime = 0;
fpsArray = new Array();
averageFps = 0;
cannonX = 50;
bounce = new Bounce();
sfxTransform = new SoundTransform(1);
musicTransform = new SoundTransform(1);
timePassed = 1;
closestBall = null;
shots = new Array();
powerups = new Array();
mouseDown = false;
reloadTime = 1;
reload = 0;
shotReady = true;
ammo = 0;
slowMotion = false;
score = 0;
cScore = 0;
scoreDisplay = 0;
cScoreDisplay = 0;
num1 = 0.1;
num2 = 0.9;
num3 = 1;
num4 = 0.4;
bmd = new BitmapData(550, 400, true, 0xFFFFFF);
bm = new Bitmap(bmd);
bf = new BlurFilter(5, 5, 3);
cmf = new ColorMatrixFilter([num1, 0, 0, 0, 0, 0, num2, 0, 0, 0, 0, 0, num3, 0, 0, 0, 0, 0, num4, 0]);
colorChange = new Array(12600, 41400, 65000, 79500, 91500, 104500, 118500, 144000, 169200, 195000, 208000, 220000, 240000, 247000, 1000000000);
colorChangeNum = 0;
ballsInPlay = new Array(new Array(100, 1), new Array(14200, 4), new Array(65000, 8), new Array(100000, 15), new Array(144000, 5), new Array(100000000, 100));
ballsInPlayNum = 0;
newBalls = new Array(100, 12600, 13100, 13600, 14000, 170000, 171000, 172000, 10000000);
newBallNum = 0;
colors = new Array(new Array(0.1, 0.9, 1, 1), new Array(0.6, 1, 0, 1), new Array(1, 0.9, 0.2, 1), new Array(1, 0.7, 1, 1), new Array(0.9, 1, 0, 1), new Array(1, 0.2, 0.2, 1), new Array(0.6, 1, 0, 1), new Array(0.1, 0.9, 1, 1), new Array(1, 0.7, 1, 1), new Array(0.1, 0.9, 1, 1), new Array(0.6, 1, 0, 1), new Array(0.9, 1, 0, 1), new Array(1, 0.9, 0.2, 1), new Array(0.6, 1, 0, 1), new Array(0.1, 0.9, 1, 1));
colorNum = 0;
ballWaves = new Array(42000, 103000, 105000, 10000000);
ballWaveNum = 0;
powerupsTime = new Array(new Array(35000, "shoot"), new Array(65000, "large"), new Array(80000, "slow"), new Array(90000, "shoot"), new Array(95000, "large"), new Array(98000, "slow"), new Array(120000, "shoot"), new Array(135000, "shoot"), new Array(136000, "slow"), new Array(140000, "shoot"), new Array(150000, "large"), new Array(153000, "shoot"), new Array(156000, "shoot"), new Array(159000, "slow"), new Array(162000, "shoot"), new Array(165000, "slow"), new Array(215000, "shoot"), new Array(2100000, "large"));
powerupsNum = 0;
endScore = 0;
paused = false;
muted = false;
lastSoundTime = 0;
super();
addFrameScript(0, frame1, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
private function moveObjects(_arg1:Event):void{
movePaddle();
moveBalls();
moveShots();
reloadShot();
movePowerup();
pScore.pScore.text = String(("Score: " + Math.floor(scoreDisplay)));
pScore.ammo.text = String(("Ammo: " + int(ammo)));
if (cScore > cScoreDisplay){
cScoreDisplay = (cScoreDisplay + 1);
};
if (Math.floor(score) > Math.floor(scoreDisplay)){
scoreDisplay = (scoreDisplay + 0.5);
} else {
if (Math.floor(score) < Math.floor(scoreDisplay)){
scoreDisplay = (scoreDisplay - 0.5);
};
};
if (musicChannel.position > colorChange[colorChangeNum]){
colorChangeNum = (colorChangeNum + 1);
colorNum = (colorNum + 1);
};
if (musicChannel.position > newBalls[newBallNum]){
newBallNum = (newBallNum + 1);
addCannon();
};
if (musicChannel.position > ballsInPlay[ballsInPlayNum][0]){
ballsInPlayNum = (ballsInPlayNum + 1);
};
if (musicChannel.position > ballWaves[ballWaveNum]){
ballWaveNum = (ballWaveNum + 1);
startBallWave();
};
if (musicChannel.position > powerupsTime[powerupsNum][0]){
addPowerup(powerupsTime[powerupsNum][1]);
powerupsNum = (powerupsNum + 1);
};
if (musicChannel.position > powerupsTime[powerupsNum][0]){
addPowerup(powerupsTime[powerupsNum][1]);
powerupsNum = (powerupsNum + 1);
};
bar.scaleX = (musicChannel.position / 251500);
if (musicChannel.position > 251500){
musicChannel.stop();
stage.removeEventListener(MouseEvent.MOUSE_DOWN, mousePressedDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseReleased);
removeChild(paddle2);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
removeEventListener(Event.ENTER_FRAME, moveObjects);
addEventListener(Event.ENTER_FRAME, updateScore);
endScoreDisplay = new EndScoreDisplay();
endScoreDisplay.x = -2000;
addChild(endScoreDisplay);
rankBackground = new RankBackground();
rankBackground.x = 135;
rankBackground.y = 500;
addChild(rankBackground);
rankBackground.rank.menuButton.addEventListener(MouseEvent.CLICK, returnToMenu);
};
}
public function keyPressedDown(_arg1:KeyboardEvent){
if (_arg1.keyCode == 80){
if (paused){
paused = false;
addEventListener(Event.ENTER_FRAME, moveObjects);
lastTime = 0;
gameMessage.text = String("Pwong");
musicChannel = music.play(lastSoundTime, 1, musicTransform);
} else {
paused = true;
removeEventListener(Event.ENTER_FRAME, moveObjects);
gameMessage.text = String("Paused");
lastSoundTime = musicChannel.position;
musicChannel.stop();
};
};
if (_arg1.keyCode == 77){
if (!paused){
if (muted){
muted = false;
sfxTransform = new SoundTransform(1);
musicTransform = new SoundTransform(1);
lastSoundTime = musicChannel.position;
musicChannel.stop();
musicChannel = music.play(lastSoundTime, 0, musicTransform);
gameMessage.text = String("Pwong");
} else {
muted = true;
sfxTransform = new SoundTransform(0);
musicTransform = new SoundTransform(0);
lastSoundTime = musicChannel.position;
musicChannel.stop();
musicChannel = music.play(lastSoundTime, 0, musicTransform);
gameMessage.text = String("Muted");
};
};
};
}
public function updateMode(_arg1:Event){
removeChild(bm);
addChild(bm);
moveMode(easyMode, 75);
moveMode(normalMode, 150);
moveMode(hardMode, 225);
}
private function addPowerupTimer(){
powerupTimer = new Timer(20000, 1);
powerupTimer.addEventListener(TimerEvent.TIMER_COMPLETE, powerupTimerHandler);
powerupTimer.start();
}
private function mousePressedDown(_arg1:MouseEvent){
mouseDown = true;
}
private function startBallWave(){
waveTimer = new Timer(300, 1);
waveTimer.addEventListener(TimerEvent.TIMER_COMPLETE, ballWaveHandler);
waveTimer.start();
}
private function shoot(){
shot = new Shot();
shot.y = (paddle.y - paddle.height);
shot.x = paddle.x;
shot.scaleX = paddle.scaleX;
addChild(shot);
shots.push(shot);
shotReady = false;
ammo = (ammo - 1);
}
public function playHard(_arg1:MouseEvent){
difficulty = "hard";
removeEventListener(Event.ENTER_FRAME, updateMode);
removeChild(easyMode);
removeChild(normalMode);
removeChild(hardMode);
gotoAndStop("play");
}
public function chooseMode(_arg1:MouseEvent){
removeChild(playButton);
removeChild(credits);
removeChild(jgames);
easyMode.x = 190;
easyMode.y = 175;
addChild(easyMode);
normalMode.x = 190;
normalMode.y = 175;
addChild(normalMode);
hardMode.x = 190;
hardMode.y = 175;
addChild(hardMode);
addEventListener(Event.ENTER_FRAME, updateMode);
easyMode.addEventListener(MouseEvent.CLICK, playEasy);
normalMode.addEventListener(MouseEvent.CLICK, playNormal);
hardMode.addEventListener(MouseEvent.CLICK, playHard);
}
function frame3(){
if (firstTime){
bmd = new BitmapData(550, 400, true, 0xFFFFFF);
bm = new Bitmap(bmd);
bf = new BlurFilter(3, 3, 3);
cmf = new ColorMatrixFilter([num1, 0, 0, 0, 0, 0, num2, 0, 0, 0, 0, 0, num3, 0, 0, 0, 0, 0, num4, 0]);
addChild(bm);
stage.addEventListener(Event.ENTER_FRAME, changeColor);
firstTime = false;
};
credits = new Credits();
credits.x = 190;
addChild(credits);
jgames = new Jgames();
jgames.x = 182;
jgames.y = 380;
addChild(jgames);
jgames.jgames.moreGames.addEventListener(MouseEvent.CLICK, goToJGames);
stop();
easyMode = new EasyMode();
normalMode = new NormalMode();
hardMode = new HardMode();
playButton.addEventListener(MouseEvent.CLICK, chooseMode);
}
function frame5(){
stop();
returnToMenuFunction();
}
private function addCustomMenuItems():void{
var _local1:ContextMenuItem;
_local1 = new ContextMenuItem("JGames");
myContextMenu.customItems.push(_local1);
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, goToJGames);
}
function frame4(){
bar.scaleX = 0;
if (showInstructions){
instructions = new Instructions();
instructions.x = 72;
instructions.y = 400;
addChild(instructions);
instructions.instructions.playButton.addEventListener(MouseEvent.CLICK, startGame);
} else {
startPaddleBall();
};
}
private function reloadShot():void{
if (((mouseDown) && (shotReady))){
if (ammo > 0){
shoot();
};
};
if (!shotReady){
reload = (reload + (0.005 * timePassed));
};
if (reload >= reloadTime){
reload = 0;
shotReady = true;
};
}
function frame1(){
stop();
trace("This games is sitelocked for armorgames.com");
addEventListener(Event.ENTER_FRAME, loadProgress);
siteLock();
addContextMenu();
}
private function addPowerup(_arg1){
powerup = new Powerup();
powerup.x = (50 + (Math.random() * 450));
powerup.y = -10;
powerup.mode = _arg1;
if (powerup.mode == "shoot"){
powerup.p.p.gotoAndStop(1);
} else {
if (powerup.mode == "slow"){
powerup.p.p.gotoAndStop(2);
} else {
if (powerup.mode == "large"){
powerup.p.p.gotoAndStop(3);
};
};
};
powerups.push(powerup);
addChild(powerup);
}
private function startPaddleBall(){
balls = new Array();
shots = new Array();
powerups = new Array();
if (difficulty == "easy"){
ballsInPlay = new Array(new Array(100, 1), new Array(14200, 4), new Array(65000, 8), new Array(100000, 15), new Array(144000, 5), new Array(100000000, 100));
newBalls = new Array(100, 12600, 13100, 13600, 14000, 170000, 171000, 172000, 10000000);
powerupsTime = new Array(new Array(35000, "shoot"), new Array(65000, "large"), new Array(80000, "slow"), new Array(90000, "shoot"), new Array(95000, "large"), new Array(98000, "slow"), new Array(120000, "shoot"), new Array(135000, "shoot"), new Array(136000, "slow"), new Array(140000, "shoot"), new Array(150000, "large"), new Array(153000, "shoot"), new Array(156000, "shoot"), new Array(159000, "slow"), new Array(162000, "shoot"), new Array(165000, "slow"), new Array(215000, "shoot"), new Array(2100000, "large"));
} else {
if (difficulty == "normal"){
ballsInPlay = new Array(new Array(100, 1), new Array(14200, 4), new Array(65000, 9), new Array(100000, 15), new Array(144000, 9), new Array(100000000, 100));
newBalls = new Array(100, 12600, 13100, 13600, 14000, 150000, 151000, 152000, 170000, 171000, 172000, 10000000);
powerupsTime = new Array(new Array(35000, "shoot"), new Array(65000, "large"), new Array(80000, "slow"), new Array(90000, "shoot"), new Array(95000, "large"), new Array(98000, "slow"), new Array(120000, "shoot"), new Array(136000, "slow"), new Array(150000, "large"), new Array(153000, "shoot"), new Array(156000, "shoot"), new Array(159000, "slow"), new Array(162000, "shoot"), new Array(165000, "slow"), new Array(215000, "shoot"), new Array(2100000, "large"));
} else {
if (difficulty == "hard"){
ballsInPlay = new Array(new Array(100, 1), new Array(14200, 7), new Array(65000, 10), new Array(100000, 15), new Array(144000, 16), new Array(100000000, 100));
newBalls = new Array(100, 12600, 13100, 13600, 14000, 14400, 14800, 150000, 151000, 152000, 170000, 171000, 172000, 10000000);
powerupsTime = new Array(new Array(35000, "shoot"), new Array(65000, "large"), new Array(80000, "slow"), new Array(90000, "shoot"), new Array(95000, "large"), new Array(98000, "slow"), new Array(120000, "shoot"), new Array(136000, "slow"), new Array(150000, "large"), new Array(153000, "shoot"), new Array(159000, "slow"), new Array(162000, "shoot"), new Array(165000, "slow"), new Array(215000, "shoot"), new Array(2100000, "large"));
};
};
};
music = new Music();
musicChannel = music.play(0, 1, musicTransform);
skala.alpha = 0;
paddle = new Paddle();
paddle.y = paddleY;
addChild(paddle);
paddle2 = new Paddle();
paddle2.y = 20;
addChild(paddle2);
paddle2.scaleY = -1;
paddle2.scaleX = -1;
paddle2.x = 275;
addChild(bm);
pScore = new PScore();
pScore.x = 100;
pScore.y = 0;
pScore.pScore.text = String("Score: 0");
addChild(pScore);
gameMessage.text = "Pwong";
lastTime = 0;
addEventListener(Event.ENTER_FRAME, moveObjects);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePressedDown);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
}
private function deactivateSlowMotion(_arg1:TimerEvent){
slowMotion = false;
}
function frame6(){
stop();
}
private function addContextMenu(){
myContextMenu = new ContextMenu();
removeDefaultItems();
addCustomMenuItems();
myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler);
this.contextMenu = myContextMenu;
}
private function removeDefaultItems():void{
myContextMenu.hideBuiltInItems();
}
private function movePaddle():void{
var _local1:Number;
var _local2:*;
if (paddle.scaleX > 1){
paddle.scaleX = (paddle.scaleX - (4E-5 * timePassed));
};
_local1 = Math.min((wallRight - (paddle.width / 2)), Math.max((wallLeft + (paddle.width / 2)), mouseX));
paddle.x = _local1;
if (closestBall != null){
_local2 = (closestBall.x - paddle2.x);
if (difficulty == "easy"){
paddle2.x = (paddle2.x + ((_local2 / 140) * timePassed));
} else {
if (difficulty == "normal"){
paddle2.x = (paddle2.x + ((_local2 / 100) * timePassed));
} else {
if (difficulty == "hard"){
paddle2.x = (paddle2.x + ((_local2 / 60) * timePassed));
};
};
};
if (paddle2.x < 65){
paddle2.x = 65;
};
if (paddle2.x > 490){
paddle2.x = 490;
};
};
}
private function applyFilter():void{
bmd.draw(this);
bmd.applyFilter(bmd, bmd.rect, new Point(0, 0), bf);
bmd.applyFilter(bmd, bmd.rect, new Point(0, 0), cmf);
}
private function ballWaveHandler(_arg1:TimerEvent){
startBallWave();
if (!paused){
cannon = new Cannon();
cannon.y = 380;
cannon.x = cannonX;
addChild(cannon);
cannonX = (cannonX + 19);
if (cannonX >= wallRight){
waveTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, ballWaveHandler);
cannonX = 50;
};
};
}
private function FramerateTracker(){
fps_txt = new TextField();
fps_txt.textColor = 0xFFFFFF;
addChild(fps_txt);
addEventListener(Event.ENTER_FRAME, getFps);
}
private function addCannonTimer(){
cannonTimer = new Timer((Math.random() * 1500), 1);
cannonTimer.addEventListener(TimerEvent.TIMER_COMPLETE, cannonTimerHandler);
cannonTimer.start();
}
private function powerupTimerHandler(_arg1:TimerEvent){
addPowerupTimer();
addPowerup("shoot");
}
private function addCannon(){
cannon = new Cannon();
cannon.y = 380;
cannon.x = ((Math.random() * 450) + 50);
addChild(cannon);
}
public function siteLock():void{
var _local1:String;
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local1 = stage.loaderInfo.url;
_local2 = (_local1.indexOf("://") + 3);
_local3 = _local1.indexOf("/", _local2);
_local4 = _local1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
if (_local4 == "armorgames.com"){
trace("This game is playing on armorgames.com: ACCESS ALLOWED");
} else {
removeEventListener(Event.ENTER_FRAME, loadProgress);
loadingBar.progressText.text = "ACCESS DENIED: Sitelocked for armorgames.com";
};
}
public function moveMode(_arg1, _arg2){
var _local3:Number;
_local3 = (_arg1.y - _arg2);
_arg1.y = (_arg1.y - (_local3 / 50));
}
private function mouseReleased(_arg1:MouseEvent){
mouseDown = false;
}
private function moveBalls(){
var _local1:int;
var _local2:*;
var _local3:*;
var _local4:int;
_local1 = 0;
if (lastTime == 0){
lastTime = getTimer();
};
timePassed = (getTimer() - lastTime);
lastTime = (lastTime + timePassed);
if (slowMotion){
timePassed = (timePassed / 2.5);
};
paddleRect = new Rectangle((paddle.x - (paddle.width / 2)), (paddle.y - (paddle.height / 2)), paddle.width, paddle.height);
paddleRect2 = new Rectangle((paddle2.x - (paddleWidth / 2)), (paddle2.y - (paddleHeight / 2)), paddleWidth, paddleHeight);
_local2 = (balls.length - 1);
for (;_local2 >= 0;_local2--) {
balls[_local2].newBallX = (balls[_local2].x + (balls[_local2].ballDX * timePassed));
balls[_local2].newBallY = (balls[_local2].y + (balls[_local2].ballDY * timePassed));
balls[_local2].oldBallRect = new Rectangle((balls[_local2].x - balls[_local2].radius), (balls[_local2].y - balls[_local2].radius), (balls[_local2].radius * 2), (balls[_local2].radius * 2));
balls[_local2].newBallRect = new Rectangle((balls[_local2].newBallX - balls[_local2].radius), (balls[_local2].newBallY - balls[_local2].radius), (balls[_local2].radius * 2), (balls[_local2].radius * 2));
j = (shots.length - 1);
while (j >= 0) {
_local3 = new Rectangle((shots[j].x - (shots[j].width / 2)), (shots[j].y - (shots[j].height / 2)), shots[j].width, shots[j].height);
if (balls[_local2].newBallRect.top <= _local3.bottom){
//unresolved if
//unresolved if
//unresolved if
balls[_local2].newBallY = (balls[_local2].newBallY - (2 * (balls[_local2].newBallRect.top - _local3.bottom)));
balls[_local2].ballDY = (balls[_local2].ballDY * -1);
balls[_local2].ballDX = ((balls[_local2].newBallX - shots[j].x) * paddleCurve);
if (balls[_local2] == closestBall){
closestBall = null;
};
} else {
if (_local3.intersects(balls[_local2].newBallRect)){
balls[_local2].newBallY = (balls[_local2].newBallY - (2 * (balls[_local2].newBallRect.bottom - _local3.top)));
balls[_local2].ballDY = (balls[_local2].ballDY * -1);
balls[_local2].ballDX = ((balls[_local2].newBallX - shots[j].x) * paddleCurve);
soundChannel = bounce.play(0, 1, sfxTransform);
};
};
j--;
};
if (balls[_local2].newBallRect.bottom >= paddleRect.top){
if (balls[_local2].oldBallRect.bottom < paddleRect.top){
if (balls[_local2].newBallRect.right > paddleRect.left){
if (balls[_local2].newBallRect.left < paddleRect.right){
balls[_local2].newBallY = (balls[_local2].newBallY - (2 * (balls[_local2].newBallRect.bottom - paddleRect.top)));
balls[_local2].ballDY = (balls[_local2].ballDY * -1);
balls[_local2].ballDX = ((balls[_local2].newBallX - paddle.x) * paddleCurve);
soundChannel = bounce.play(0, 1, sfxTransform);
};
};
} else {
if (balls[_local2].newBallRect.top > 400){
if (balls[_local2] == closestBall){
closestBall = null;
};
score = (score - (60 / (balls.length * 1.5)));
removeChild(balls[_local2]);
balls.splice(_local2, 1);
if (balls.length < ballsInPlay[(ballsInPlayNum - 1)][1]){
addCannonTimer();
};
continue;
};
};
};
};
}
public function loadProgress(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = this.root.loaderInfo.bytesLoaded;
_local3 = this.root.loaderInfo.bytesTotal;
_local4 = (_local2 / 0x0400);
_local5 = (_local3 / 0x0400);
loadingBar1.scaleX = (_local4 / _local5);
if (_local2 >= _local3){
removeEventListener(Event.ENTER_FRAME, loadProgress);
play();
};
}
private function updateScore(_arg1:Event){
var _local2:int;
if (skala.alpha < 1){
skala.alpha = (skala.alpha + 0.01);
};
i = (balls.length - 1);
while (i >= 0) {
balls[i].alpha = (balls[i].alpha - 0.05);
if (balls[i].alpha <= 0){
balls.splice(i, 1);
};
i--;
};
i = (shots.length - 1);
while (i >= 0) {
shots[i].alpha = (shots[i].alpha - 0.05);
if (shots[i].alpha <= 0){
shots.splice(i, 1);
};
i--;
};
i = (powerups.length - 1);
while (i >= 0) {
powerups[i].alpha = (powerups[i].alpha - 0.05);
if (powerups[i].alpha <= 0){
powerups.splice(i, 1);
};
i--;
};
if (score > 0){
if (paddle.x > 65){
paddle.x = (paddle.x - 5);
} else {
if (Math.floor(score) > endScore){
paddle.y = (paddle.y - 0.4);
endScoreDisplay.y = (paddle.y - 45);
endScoreDisplay.x = (paddle.x - 70);
if (Math.floor(score) > endScore){
endScore = (endScore + 1);
};
gameMessage2.text = String("");
if (difficulty == "easy"){
gameMessage.text = String("Easy Mode");
} else {
if (difficulty == "normal"){
gameMessage.text = String("Normal Mode");
} else {
if (difficulty == "hard"){
gameMessage.text = String("Hard Mode");
};
};
};
endScoreDisplay.score.text = String(int(endScore));
};
};
_local2 = -100;
if (difficulty == "easy"){
_local2 = -90;
} else {
if (difficulty == "normal"){
_local2 = -145;
} else {
if (difficulty == "hard"){
_local2 = -200;
};
};
};
if ((((endScore > 0)) && ((endScore < (100 + _local2))))){
rank = "Barely Scorable";
} else {
if ((((endScore > (100 + _local2))) && ((endScore < (200 + _local2))))){
rank = "Pre-Pre-Beginner";
} else {
if ((((endScore > (200 + _local2))) && ((endScore < (275 + _local2))))){
rank = "Pre-Beginner";
} else {
if ((((endScore > (275 + _local2))) && ((endScore < (325 + _local2))))){
rank = "Beginner";
} else {
if ((((endScore > (325 + _local2))) && ((endScore < (375 + _local2))))){
rank = "Novice";
} else {
if ((((endScore > (375 + _local2))) && ((endScore < (400 + _local2))))){
rank = "Acceptable";
} else {
if ((((endScore > (400 + _local2))) && ((endScore < (425 + _local2))))){
rank = "Not Bad";
} else {
if ((((endScore > (425 + _local2))) && ((endScore < (450 + _local2))))){
rank = "Intermediate";
} else {
if ((((endScore > (450 + _local2))) && ((endScore < (475 + _local2))))){
rank = "Intermediate+";
} else {
if ((((endScore > (475 + _local2))) && ((endScore < (500 + _local2))))){
rank = "Advanced";
} else {
if ((((endScore > (500 + _local2))) && ((endScore < (525 + _local2))))){
rank = "Advanced+";
} else {
if ((((endScore > (525 + _local2))) && ((endScore < (550 + _local2))))){
rank = "Decent";
} else {
if ((((endScore > (550 + _local2))) && ((endScore < (575 + _local2))))){
rank = "Very Good";
} else {
if ((((endScore > (575 + _local2))) && ((endScore < (600 + _local2))))){
rank = "Almost Pro";
} else {
if ((((endScore > (600 + _local2))) && ((endScore < (625 + _local2))))){
rank = "Hardcore Pwonger";
} else {
if ((((endScore > (625 + _local2))) && ((endScore < (645 + _local2))))){
rank = "Pro";
} else {
if ((((endScore > (645 + _local2))) && ((endScore < (660 + _local2))))){
rank = "Pro+";
} else {
if ((((endScore > (660 + _local2))) && ((endScore < (675 + _local2))))){
rank = "Pro++";
} else {
if ((((endScore > (675 + _local2))) && ((endScore < (690 + _local2))))){
rank = "Master";
} else {
if ((((endScore > (690 + _local2))) && ((endScore < (705 + _local2))))){
rank = "Master+";
} else {
if ((((endScore > (705 + _local2))) && ((endScore < (720 + _local2))))){
rank = "Hypher Sonic Pwonger";
} else {
if (endScore > (720 + _local2)){
rank = "PWONG PWNER";
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
rankBackground.rank.rankTxt.text = String(rank);
} else {
if (score < 0){
gameMessage.text = "You Lose!";
} else {
if (score == 0){
gameMessage.text = "It's a tie!";
};
};
};
}
public function playNormal(_arg1:MouseEvent){
difficulty = "normal";
removeEventListener(Event.ENTER_FRAME, updateMode);
removeChild(easyMode);
removeChild(normalMode);
removeChild(hardMode);
gotoAndStop("play");
}
public function playEasy(_arg1:MouseEvent){
difficulty = "easy";
removeEventListener(Event.ENTER_FRAME, updateMode);
removeChild(easyMode);
removeChild(normalMode);
removeChild(hardMode);
gotoAndStop("play");
}
private function moveShots():void{
j = (shots.length - 1);
while (j >= 0) {
shots[j].y = (shots[j].y - (0.15 * timePassed));
if (shots[j].y < 200){
shots[j].alpha = (shots[j].alpha - (0.004 * timePassed));
};
if ((((shots[j].y < 0)) || ((shots[j].alpha <= 0)))){
removeChild(shots[j]);
shots.splice(j, 1);
};
j--;
};
}
public function startGame(_arg1:MouseEvent){
removeChild(instructions);
startPaddleBall();
}
private function endGame(){
}
private function menuSelectHandler(_arg1:ContextMenuEvent){
lastTime = 0;
}
private function addSlowMotionTimer(){
slowMotionTimer = new Timer(8000, 1);
slowMotionTimer.addEventListener(TimerEvent.TIMER_COMPLETE, deactivateSlowMotion);
slowMotionTimer.start();
}
private function getFps(_arg1:Event):void{
time = getTimer();
fps = (1000 / (time - prevTime));
prevTime = getTimer();
fpsArray.push(fps);
averageFps = (averageFps + fpsArray[(fpsArray.length - 1)]);
if (fpsArray.length == 25){
averageFps = (averageFps / fpsArray.length);
fps_txt.text = ("fps: " + int((averageFps + 1)));
fps_txt.textColor = 0xFFFFFF;
fpsArray = new Array();
averageFps = 0;
};
}
private function movePowerup():void{
var _local1:*;
i = (powerups.length - 1);
while (i >= 0) {
powerups[i].y = (powerups[i].y + (0.09 * timePassed));
_local1 = new Rectangle((powerups[i].x - (powerups[i].width / 2)), (powerups[i].y - (powerups[i].height / 2)), powerups[i].width, powerups[i].height);
if (_local1.intersects(paddleRect)){
if (powerups[i].mode == "slow"){
slowMotion = true;
addSlowMotionTimer();
gameMessage.text = String("Slow Motion");
gameMessage2.text = String("");
} else {
if (powerups[i].mode == "large"){
paddle.scaleX = (paddle.scaleX + 1);
gameMessage.text = String("Larger Paddle");
gameMessage2.text = String("");
} else {
if (powerups[i].mode == "shoot"){
ammo = (ammo + 10);
gameMessage.text = String("Ammo +10");
gameMessage2.text = String("click to shoot");
} else {
if (powerups[i].mode == "score"){
gameMessage.text = String("Score Multiplier +1");
gameMessage2.text = String("");
};
};
};
};
removeChild(powerups[i]);
powerups.splice(i, 1);
} else {
if (powerups[i].y > 460){
removeChild(powerups[i]);
powerups.splice(i, 1);
};
};
i--;
};
}
public function returnToMenuFunction(){
stage.addEventListener(Event.ENTER_FRAME, changeColor);
gotoAndStop("Menu");
removeEventListener(Event.ENTER_FRAME, updateScore);
if (endScoreDisplay){
removeChild(endScoreDisplay);
};
if (rankBackground != null){
removeChild(rankBackground);
};
if (paddle){
removeChild(paddle);
};
if (pScore){
removeChild(pScore);
};
endScore = 0;
score = 0;
ammo = 0;
scoreDisplay = 0;
slowMotion = false;
ballsInPlayNum = 0;
colorChangeNum = 0;
newBallNum = 0;
colorNum = 0;
ballWaveNum = 0;
powerupsNum = 0;
closestBall = null;
}
private function returnToMenu(_arg1:MouseEvent){
stage.removeEventListener(Event.ENTER_FRAME, changeColor);
returnToMenuFunction();
}
public function newBall(_arg1, _arg2){
ball = new MovieClip();
ball.x = _arg1;
ball.y = _arg2;
ball.radius = 5;
ball.ballSpeed = 0.2;
ball.collision = 0;
ball.ballDX = 0;
if (ball.y > 200){
ball.ballDY = -(ball.ballSpeed);
} else {
ball.ballDY = ball.ballSpeed;
ball.radius = 3;
};
ball.graphics.beginFill(0xFFFFFF);
ball.graphics.drawCircle(0, 0, ball.radius);
ball.graphics.endFill();
balls.push(ball);
addChild(ball);
}
public function goToJGames(_arg1:Event){
var _local2:*;
var _local3:URLRequest;
_local2 = "http://www.jgames.ch";
_local3 = new URLRequest(_local2);
navigateToURL(_local3, "_blank");
}
private function changeColor(_arg1:Event){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = (colors[colorNum][0] - num1);
_local3 = (colors[colorNum][1] - num2);
_local4 = (colors[colorNum][2] - num3);
_local5 = (colors[colorNum][3] - num4);
num1 = (num1 + (_local2 / 25));
num2 = (num2 + (_local3 / 25));
num3 = (num3 + (_local4 / 25));
num4 = (num4 + (_local5 / 25));
cmf = new ColorMatrixFilter([num1, 0, 0, 0, 0, 0, num2, 0, 0, 0, 0, 0, num3, 0, 0, 0, 0, 0, num4, 0]);
applyFilter();
}
private function cannonTimerHandler(_arg1:TimerEvent){
addCannon();
}
}
}//package
Section 26
//Powerup (Powerup)
package {
import flash.display.*;
public dynamic class Powerup extends MovieClip {
public var p:MovieClip;
}
}//package
Section 27
//PScore (PScore)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PScore extends MovieClip {
public var pScore:TextField;
public var ammo:TextField;
}
}//package
Section 28
//RankBackground (RankBackground)
package {
import flash.display.*;
public dynamic class RankBackground extends MovieClip {
public var rank:MovieClip;
public function RankBackground(){
addFrameScript(49, frame50);
}
function frame50(){
stop();
}
}
}//package
Section 29
//Shot (Shot)
package {
import flash.display.*;
public dynamic class Shot extends MovieClip {
}
}//package
Section 30
//Splash (Splash)
package {
import flash.display.*;
public dynamic class Splash extends MovieClip {
public var splash:Splash;
public function Splash(){
addFrameScript(0, frame1);
}
function frame1(){
splash = new Splash();
addChild(splash);
}
}
}//package