Section 1
//Effects (com.fx.Effects)
package com.fx {
import flash.display.*;
public class Effects extends MovieClip {
public var effect;
public function Effects(_arg1:String){
switch (_arg1){
case "koe":
effect = new Explosie_koe();
effect.scaleX = (effect.scaleY = 0.7);
break;
case "beer":
effect = new Explosie_def();
effect.scaleX = (effect.scaleY = 0.3);
break;
case "komeet":
effect = new Explosie_def();
effect.scaleX = (effect.scaleY = 0.25);
break;
case "ufo":
effect = new Explosie_def();
effect.scaleX = (effect.scaleY = 0.2);
break;
default:
effect = new Explosie_def();
effect.scaleX = (effect.scaleY = 0.4);
break;
};
}
}
}//package com.fx
Section 2
//Explosie_def (com.fx.Explosie_def)
package com.fx {
import flash.display.*;
public class Explosie_def extends MovieClip {
public function Explosie_def(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package com.fx
Section 3
//Explosie_koe (com.fx.Explosie_koe)
package com.fx {
import flash.display.*;
public class Explosie_koe extends MovieClip {
public function Explosie_koe(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package com.fx
Section 4
//ShieldFX (com.fx.ShieldFX)
package com.fx {
import flash.display.*;
public class ShieldFX extends MovieClip {
}
}//package com.fx
Section 5
//Tekst (com.fx.Tekst)
package com.fx {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Tekst extends Sprite {
private var duurInSeconde:uint;
private var timer:Timer;
private var txt:TextField;
private var objectPunten:int;
public function Tekst(_arg1:int){
this.objectPunten = _arg1;
duurInSeconde = 2;
txt = new TextField();
addChild(txt);
setTekst();
setTimer();
}
private function setTimer():void{
timer = new Timer((1000 / 30), (30 * duurInSeconde));
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, completeHandler);
timer.start();
}
private function timerHandler(_arg1:TimerEvent):void{
txt.y = (txt.y - 2);
txt.alpha = (txt.alpha - 0.03);
}
private function setTekst():void{
txt.text = objectPunten.toString();
txt.selectable = false;
txt.embedFonts = true;
txt.setTextFormat(new TextFormat("Sydnie", 25, 0xFFFF00, true));
txt.x = -25;
}
private function completeHandler(_arg1:TimerEvent):void{
removeChild(txt);
this.parent.removeChild(this);
}
}
}//package com.fx
Section 6
//Bomb (com.powerups.Bomb)
package com.powerups {
import com.*;
public class Bomb extends Powerup {
public var punten:int;
public var kracht:int;
public function Bomb(_arg1:int, _arg2:uint, _arg3:int, _arg4:int){
super(this, _arg1, _arg2);
this.kracht = _arg3;
this.punten = _arg4;
this.scaleX = (this.scaleY = 0.9);
}
}
}//package com.powerups
Section 7
//Health (com.powerups.Health)
package com.powerups {
import flash.display.*;
import com.*;
public class Health extends Powerup {
public var punten:int;
public var mc:MovieClip;
public var kracht:int;
public function Health(_arg1:int, _arg2:uint, _arg3:int, _arg4:int){
addFrameScript(0, frame1, 1, frame2);
super(this, _arg1, _arg2);
this.kracht = _arg3;
this.punten = _arg4;
this.scaleX = (this.scaleY = 0.15);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package com.powerups
Section 8
//Shield (com.powerups.Shield)
package com.powerups {
import com.*;
public class Shield extends Powerup {
public var punten:int;
public var kracht:int;
public function Shield(_arg1:int, _arg2:uint, _arg3:int, _arg4:int){
super(this, _arg1, _arg2);
this.kracht = _arg3;
this.punten = _arg4;
this.scaleX = (this.scaleY = 0.23);
}
}
}//package com.powerups
Section 9
//Beer (com.vijanden.Beer)
package com.vijanden {
import flash.display.*;
import com.*;
public class Beer extends Tegenstand {
public var punten:int;
public var kracht:int;
public var hitted:MovieClip;
public function Beer(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int){
super(this, _arg1, _arg2);
this.kracht = _arg3;
this.punten = _arg4;
this.scaleX = (this.scaleY = 0.68);
}
}
}//package com.vijanden
Section 10
//Koe (com.vijanden.Koe)
package com.vijanden {
import flash.display.*;
import com.*;
public class Koe extends Tegenstand {
public var punten:int;
public var kracht:int;
public var hitted:MovieClip;
public function Koe(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int){
super(this, _arg1, _arg2);
this.kracht = _arg3;
this.punten = _arg4;
this.scaleX = (this.scaleY = 0.65);
}
}
}//package com.vijanden
Section 11
//Komeet (com.vijanden.Komeet)
package com.vijanden {
import flash.display.*;
import com.*;
public class Komeet extends Tegenstand {
public var punten:int;
public var kracht:int;
public var hitted:MovieClip;
public function Komeet(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int){
super(this, _arg1, _arg2);
this.kracht = _arg3;
this.punten = _arg4;
this.scaleX = (this.scaleY = 0.47);
}
}
}//package com.vijanden
Section 12
//Ufo (com.vijanden.Ufo)
package com.vijanden {
import flash.display.*;
import com.*;
public class Ufo extends Tegenstand {
public var punten:int;
public var kracht:int;
public var hitted:MovieClip;
public function Ufo(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int){
super(this, _arg1, _arg2);
this.scaleX = (this.scaleY = 0.3);
this.kracht = _arg3;
this.punten = _arg4;
}
}
}//package com.vijanden
Section 13
//Main (com.Main)
package com {
public class Main {
public static var startSpel:Boolean = false;
public static var updateScore:Function;
private static var planetHealth:int = 100;
public static var updateSpelerHealth:Function;
private static var lijstVijanden:Array = new Array();
private static var score:uint = 0;
private static var lijstTest:Array = new Array();
private static var lijstPowerups:Array = new Array();
public static var updatePlanetHealth:Function;
public static function get getPlanetHealth():int{
return (planetHealth);
}
public static function get getScore():uint{
return (score);
}
public static function set setScore(_arg1:uint):void{
score = _arg1;
}
public static function set setLijstVijanden(_arg1:Array):void{
lijstVijanden = _arg1;
}
public static function get getLijstPowerups():Array{
return (lijstPowerups);
}
public static function get getLijstVijanden():Array{
return (lijstVijanden);
}
public static function get getLijstTest():Array{
return (lijstTest);
}
public static function wijzigScore(_arg1:int):void{
updateScore(_arg1);
}
public static function set setPlanetHealth(_arg1:int):void{
planetHealth = _arg1;
}
public static function wijzigPlanetHealth(_arg1:int):void{
planetHealth = (planetHealth - _arg1);
updatePlanetHealth();
}
public static function set setLijstTest(_arg1:Array):void{
lijstTest = _arg1;
}
public static function set setLijstPowerups(_arg1:Array):void{
lijstPowerups = _arg1;
}
}
}//package com
Section 14
//Objecten (com.Objecten)
package com {
import flash.events.*;
import flash.display.*;
import com.fx.*;
import flash.utils.*;
public class Objecten extends MovieClip {
public var stageBreedte:Number;
public var snelheid:Number;
public var startAfstand:Number;
public var middelPuntY:Number;
public var middelPuntX:Number;
public var startPositie:uint;
private var timerBeweging:Timer;
public var stageHoogte:Number;
public var targetMC:MovieClip;
public function Objecten(_arg1:MovieClip, _arg2:Number){
this.targetMC = _arg1;
this.snelheid = _arg2;
}
public function setStageProperties():void{
stageBreedte = targetMC.stage.stageWidth;
stageHoogte = targetMC.stage.stageHeight;
middelPuntX = (stageBreedte / 2);
middelPuntY = (stageHoogte / 2);
}
public function stopBeweging():void{
timerBeweging.removeEventListener(TimerEvent.TIMER, beweegObject);
}
public function bepaalAfstandTotMidden():uint{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Math.abs((targetMC.x - middelPuntX));
_local2 = Math.abs((targetMC.y - middelPuntY));
_local3 = Math.round(Math.sqrt(((_local1 * _local1) + (_local2 * _local2))));
return (_local3);
}
public function bepaalStartpositie():void{
startAfstand = 380;
startPositie = Math.floor((Math.random() * 360));
positioneerObject();
}
public function startBeweging():void{
timerBeweging = new Timer((1000 / 30), 0);
timerBeweging.addEventListener(TimerEvent.TIMER, beweegObject);
timerBeweging.start();
}
public function positioneerObject():void{
var _local1:Number;
var _local2:Number;
_local1 = (targetMC.rotation = startPositie);
_local2 = ((_local1 * Math.PI) / 180);
targetMC.x = (middelPuntX + (Math.cos(_local2) * startAfstand));
targetMC.y = (middelPuntY + (Math.sin(_local2) * startAfstand));
}
public function puntenAnimatie(_arg1:int):void{
var _local2:Tekst;
_local2 = new Tekst(_arg1);
targetMC.stage.addChild(_local2);
_local2.x = this.x;
_local2.y = this.y;
}
protected function beweegObject(_arg1:TimerEvent):void{
startAfstand = (startAfstand - snelheid);
positioneerObject();
}
}
}//package com
Section 15
//Powerup (com.Powerup)
package com {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
public class Powerup extends Objecten {
private var mc:MovieClip;
private var colorSpeed:int;
private var ct:ColorTransform;
public var spelerHitByPowerup:Boolean;
public var gezondheid:Number;
private var lijstPowerups:Array;
public function Powerup(_arg1:MovieClip, _arg2:Number, _arg3:Number){
super(_arg1, _arg3);
this.gezondheid = _arg2;
spelerHitByPowerup = false;
colorSpeed = 10;
if (this.getChildByName("mc") != null){
mc = (this.getChildByName("mc") as MovieClip);
};
}
public function deletePowerup():void{
super.stopBeweging();
this.parent.removeChild(this);
}
private function checkCollision():void{
var _local1:uint;
_local1 = super.bepaalAfstandTotMidden();
if (_local1 < 55){
super.stopBeweging();
this.nextFrame();
};
}
private function timerHandler(_arg1:TimerEvent):void{
var _local2:Timer;
ct.redOffset = (ct.redOffset + colorSpeed);
ct.greenOffset = (ct.greenOffset + colorSpeed);
ct.blueOffset = (ct.blueOffset + colorSpeed);
ct.alphaOffset = (ct.alphaOffset - colorSpeed);
this.transform.colorTransform = ct;
_local2 = (_arg1.currentTarget as Timer);
if ((((((ct.redOffset >= 0xFF)) && ((ct.blueOffset >= 0xFF)))) && ((ct.greenOffset >= 0xFF)))){
_local2.removeEventListener(TimerEvent.TIMER, timerHandler);
deletePowerup();
};
}
private function deletePowerupUitArray():void{
var _local1:uint;
lijstPowerups = Main.getLijstPowerups;
_local1 = 0;
while (_local1 < lijstPowerups.length) {
if (this == lijstPowerups[_local1].object){
lijstPowerups.splice(_local1, 1);
Main.setLijstPowerups = lijstPowerups;
break;
};
_local1++;
};
}
public function updateGezondheid(){
if (gezondheid > 0){
gezondheid--;
if (gezondheid == 0){
deleteScene();
};
};
}
private function powerupUitArray(){
var _local1:uint;
lijstPowerups = Main.getLijstPowerups;
_local1 = 0;
while (_local1 < lijstPowerups.length) {
if (this == lijstPowerups[_local1].object){
return (lijstPowerups[_local1]);
};
_local1++;
};
}
private function deleteScene():void{
var _local1:Timer;
super.stopBeweging();
if (spelerHitByPowerup){
Main.wijzigScore(powerupUitArray().object.punten);
super.puntenAnimatie(powerupUitArray().object.punten);
};
deletePowerupUitArray();
ct = this.transform.colorTransform;
_local1 = new Timer((1000 / 30), 0);
_local1.addEventListener(TimerEvent.TIMER, timerHandler);
_local1.start();
}
override protected function beweegObject(_arg1:TimerEvent):void{
super.beweegObject(_arg1);
checkCollision();
if (mc != null){
mc.rotation = (mc.rotation + 3.27);
};
}
}
}//package com
Section 16
//Richter (com.Richter)
package com {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.ui.*;
public class Richter extends MovieClip {
private var schietTimer:Timer;
private var lijn:Sprite;
private var target:Boolean;
private var schietInterval:uint;
private var lijstVijanden:Array;
private var lijstPowerups:Array;
public function init():void{
this.scaleX = (this.scaleY = 0.6);
this.alpha = 0.75;
this.x = this.stage.mouseX;
this.y = this.stage.mouseY;
lijn = new Sprite();
target = false;
schietInterval = 200;
schietTimer = new Timer(schietInterval, 0);
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, attachMuis);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, startTargetVijand);
this.stage.addEventListener(MouseEvent.MOUSE_UP, stopTargetVijand);
schietTimer.addEventListener(TimerEvent.TIMER, schietVijand);
Mouse.hide();
}
public function stopRichter(){
this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, attachMuis);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, startTargetVijand);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, stopTargetVijand);
schietTimer.removeEventListener(TimerEvent.TIMER, schietVijand);
Mouse.show();
}
private function schietVijand(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:uint;
var _local4:uint;
if (target){
lijstVijanden = Main.getLijstVijanden;
lijstPowerups = Main.getLijstPowerups;
_local2 = new Point(this.x, this.y);
_local3 = 0;
while (_local3 < lijstVijanden.length) {
if (lijstVijanden[_local3].object.hitTestPoint(_local2.x, _local2.y, true)){
if (lijstVijanden[_local3].object.gezondheid == 1){
lijstVijanden[_local3].object.gunHit = true;
};
lijstVijanden[_local3].object.updateGezondheid();
break;
};
_local3++;
};
_local4 = 0;
while (_local4 < lijstPowerups.length) {
if (lijstPowerups[_local4].object.hitTestPoint(_local2.x, _local2.y, true)){
lijstPowerups[_local4].object.updateGezondheid();
break;
};
_local4++;
};
};
}
private function stopTargetVijand(_arg1:MouseEvent):void{
schietTimer.stop();
target = false;
}
public function updateLaser(_arg1:Number, _arg2:Number):void{
lijn.graphics.clear();
lijn.graphics.lineStyle(2, 0xFF0000, 0.25);
lijn.graphics.moveTo(_arg1, _arg2);
lijn.graphics.lineTo(this.stage.mouseX, this.stage.mouseY);
this.stage.addChild(lijn);
}
private function attachMuis(_arg1:MouseEvent):void{
this.x = this.stage.mouseX;
this.y = this.stage.mouseY;
this.rotation++;
Mouse.hide();
_arg1.updateAfterEvent();
}
private function startTargetVijand(_arg1:MouseEvent):void{
schietTimer.start();
target = true;
}
}
}//package com
Section 17
//Speler (com.Speler)
package com {
import flash.events.*;
import flash.display.*;
import com.fx.*;
import flash.utils.*;
import flash.geom.*;
public class Speler extends Objecten {
public var astrodude_mc:MovieClip;
public var shieldUp:Boolean;
public var scaleFactor:Number;
private var key:uint;
public var armgun_mc:MovieClip;
public var armgun:MovieClip;
private var shield:ShieldFX;
private var keyPressed:Boolean;
public var richter:Richter;
private var gameover:Boolean;
public var gezondheid:Number;
public function Speler(_arg1:uint=1, _arg2:uint=5){
addFrameScript(0, frame1, 15, frame16, 16, frame17);
super(this, _arg2);
this.gezondheid = _arg1;
}
private function startSchieten(_arg1:MouseEvent):void{
armgun.play();
}
public function init():void{
super.setStageProperties();
bepaalStartpositie();
startBesturing();
scaleFactor = 0.32;
shieldUp = false;
keyPressed = false;
gameover = false;
this.scaleX = (this.scaleY = scaleFactor);
armgun = ((this.getChildByName("armgun_mc") as MovieClip).getChildByName("gun_mc") as MovieClip);
richter = new Richter();
this.stage.addChild(richter);
richter.init();
}
private function naarLinks():void{
if (super.startPositie > (0 + super.snelheid)){
super.startPositie = (super.startPositie - super.snelheid);
} else {
super.startPositie = 360;
};
super.positioneerObject();
this.play();
}
private function stopSpeler(_arg1:KeyboardEvent):void{
keyPressed = false;
}
private function moveHandler(_arg1:MouseEvent):void{
}
function frame16(){
gotoAndPlay("walk");
}
function frame1(){
stop();
}
override public function bepaalStartpositie():void{
startAfstand = ((100 / 2) - 8);
startPositie = (360 - Math.floor((Math.random() * 360)));
super.positioneerObject();
}
public function startBesturing(){
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, startSpeler);
this.stage.addEventListener(KeyboardEvent.KEY_UP, stopSpeler);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, startSchieten);
this.stage.addEventListener(MouseEvent.MOUSE_UP, stopSchieten);
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
this.addEventListener(Event.ENTER_FRAME, bestuurSpeler);
}
private function stopSchieten(_arg1:MouseEvent):void{
armgun.gotoAndStop("normaal");
}
private function shieldPosHandler(_arg1:TimerEvent):void{
shield.x = this.x;
shield.y = this.y;
}
public function deleteScene():void{
if (gameover == false){
gameover = true;
stopBesturing();
armgun.gotoAndStop("normaal");
this.gotoAndStop("die");
richter.stopRichter();
this.stage.removeChild(richter);
};
}
function frame17(){
stop();
}
private function startSpeler(_arg1:KeyboardEvent):void{
key = _arg1.charCode;
keyPressed = true;
}
private function naarRechts():void{
if (super.startPositie < (360 - super.snelheid)){
super.startPositie = (super.startPositie + super.snelheid);
} else {
super.startPositie = 0;
};
super.positioneerObject();
this.play();
}
public function gebruikShield():void{
var _local1:Timer;
if (shield == null){
shield = new ShieldFX();
this.stage.addChild(shield);
};
_local1 = new Timer((1000 / 30), 0);
_local1.addEventListener(TimerEvent.TIMER, shieldPosHandler);
_local1.start();
}
private function bestuurSpeler(_arg1:Event):void{
if (keyPressed){
switch (key){
case 100:
naarRechts();
break;
case 97:
naarLinks();
break;
};
} else {
stopLopen();
};
richtingSpeler();
richtWapen();
}
function stopLopen():void{
if (this.currentFrame == (this.totalFrames - 1)){
this.gotoAndStop("stay");
};
}
private function richtingSpeler():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = (this.stage.mouseX - super.middelPuntX);
_local2 = (this.stage.mouseY - super.middelPuntY);
_local3 = ((Math.atan2(_local2, _local1) * 180) / Math.PI);
_local4 = (this.x - super.middelPuntX);
_local5 = (this.y - super.middelPuntY);
_local6 = ((Math.atan2(_local5, _local4) * 180) / Math.PI);
if (_local3 < _local6){
if ((((_local6 > 0)) && ((_local3 < 0)))){
if (_local3 > (_local6 - 180)){
this.scaleY = -(scaleFactor);
} else {
this.scaleY = scaleFactor;
};
} else {
this.scaleY = -(scaleFactor);
};
} else {
if ((((_local6 < 0)) && ((_local3 > 0)))){
if (_local3 < (_local6 + 180)){
this.scaleY = scaleFactor;
} else {
this.scaleY = -(scaleFactor);
};
} else {
this.scaleY = scaleFactor;
};
};
}
private function richtWapen():void{
var _local1:Point;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = new Point(armgun.parent.x, armgun.parent.y);
_local2 = this.localToGlobal(_local1).x;
_local3 = this.localToGlobal(_local1).y;
_local4 = (this.stage.mouseX - _local2);
_local5 = (this.stage.mouseY - _local3);
if (this.scaleY == scaleFactor){
_local6 = Math.atan2(_local5, _local4);
_local7 = ((((_local6 * 180) / Math.PI) - super.startPositie) - 90);
armgun.rotation = _local7;
} else {
_local6 = Math.atan2(-(_local5), -(_local4));
_local7 = ((-(((_local6 * 180) / Math.PI)) + super.startPositie) + 90);
armgun.rotation = _local7;
};
}
public function stopBesturing(){
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, startSpeler);
this.stage.removeEventListener(KeyboardEvent.KEY_UP, stopSpeler);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, startSchieten);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, stopSchieten);
this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
this.removeEventListener(Event.ENTER_FRAME, bestuurSpeler);
}
}
}//package com
Section 18
//Tegenstand (com.Tegenstand)
package com {
import flash.events.*;
import flash.display.*;
import com.fx.*;
import flash.utils.*;
public class Tegenstand extends Objecten {
public var gunHit:Boolean;
public var updateScore:Function;
public var spelerHit:Boolean;
private var explosie:Effects;
public var bombHit:Boolean;
private var mc:MovieClip;
private var lijstVijanden:Array;
public var planetHit:Boolean;
public var gezondheid:Number;
public function Tegenstand(_arg1:MovieClip, _arg2:Number, _arg3:Number){
super(_arg1, _arg3);
this.gezondheid = _arg2;
if (this.getChildByName("hitted") != null){
mc = (this.getChildByName("hitted") as MovieClip);
};
planetHit = false;
spelerHit = false;
gunHit = false;
bombHit = false;
}
private function deleteVijandUitArray():void{
var _local1:uint;
lijstVijanden = Main.getLijstVijanden;
_local1 = 0;
while (_local1 < lijstVijanden.length) {
if (this == lijstVijanden[_local1].object){
lijstVijanden.splice(_local1, 1);
Main.setLijstVijanden = lijstVijanden;
break;
};
_local1++;
};
}
public function deleteVijand(_arg1:Boolean):void{
if (((((((((!(_arg1)) && (!(planetHit)))) && (!(spelerHit)))) && (!(gunHit)))) || (bombHit))){
deleteVijandUitArray();
};
super.stopBeweging();
this.parent.removeChild(this);
}
private function checkCollision():void{
var _local1:uint;
_local1 = super.bepaalAfstandTotMidden();
if (_local1 < 50){
gezondheid = 1;
planetHit = true;
updateGezondheid();
};
}
private function timerHandler(_arg1:TimerEvent):void{
var _local2:Timer;
_local2 = (_arg1.currentTarget as Timer);
if (this.explosie.effect.currentFrame == this.explosie.effect.totalFrames){
_local2.removeEventListener(TimerEvent.TIMER, timerHandler);
this.stage.removeChild(explosie.effect);
deleteVijand(false);
};
}
public function updateGezondheid(){
if (gezondheid > 0){
gezondheid--;
if (mc.currentFrame == 1){
mc.gotoAndPlay("hit");
};
if (gezondheid == 0){
deleteScene();
};
};
}
private function vijandUitArray(){
var _local1:uint;
lijstVijanden = Main.getLijstVijanden;
_local1 = 0;
while (_local1 < lijstVijanden.length) {
if (this == lijstVijanden[_local1].object){
return (lijstVijanden[_local1]);
};
_local1++;
};
}
private function deleteScene():void{
var _local1:int;
var _local2:int;
var _local3:Timer;
super.stopBeweging();
if (explosie == null){
explosie = new Effects(vijandUitArray().naam);
this.stage.addChild(explosie.effect);
explosie.effect.x = this.x;
explosie.effect.y = this.y;
this.alpha = 0;
_local1 = vijandUitArray().object.kracht;
_local2 = vijandUitArray().object.punten;
if (((((planetHit) || (spelerHit))) || (gunHit))){
deleteVijandUitArray();
};
if (gunHit){
Main.wijzigScore(_local2);
super.puntenAnimatie(_local2);
};
if (planetHit){
Main.wijzigPlanetHealth(_local1);
};
_local3 = new Timer((1000 / 30), 0);
_local3.addEventListener(TimerEvent.TIMER, timerHandler);
_local3.start();
};
}
override protected function beweegObject(_arg1:TimerEvent):void{
super.beweegObject(_arg1);
checkCollision();
if (mc != null){
mc.rotation = (mc.rotation + 3.27);
};
}
}
}//package com
Section 19
//armgun_50 (Space_fla.armgun_50)
package Space_fla {
import flash.display.*;
public dynamic class armgun_50 extends MovieClip {
public function armgun_50(){
addFrameScript(0, frame1, 13, frame14);
}
function frame14(){
gotoAndPlay("vuur");
}
function frame1(){
stop();
}
}
}//package Space_fla
Section 20
//armguncon_49 (Space_fla.armguncon_49)
package Space_fla {
import flash.display.*;
public dynamic class armguncon_49 extends MovieClip {
public var gun_mc:MovieClip;
}
}//package Space_fla
Section 21
//Astrodude_54 (Space_fla.Astrodude_54)
package Space_fla {
import flash.display.*;
public dynamic class Astrodude_54 extends MovieClip {
public var body_mc:MovieClip;
}
}//package Space_fla
Section 22
//AstronutDie_65 (Space_fla.AstronutDie_65)
package Space_fla {
import flash.display.*;
public dynamic class AstronutDie_65 extends MovieClip {
public function AstronutDie_65(){
addFrameScript(25, frame26);
}
function frame26(){
stop();
}
}
}//package Space_fla
Section 23
//beerhitted_29 (Space_fla.beerhitted_29)
package Space_fla {
import flash.display.*;
public dynamic class beerhitted_29 extends MovieClip {
public function beerhitted_29(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Space_fla
Section 24
//body_57 (Space_fla.body_57)
package Space_fla {
import flash.display.*;
public dynamic class body_57 extends MovieClip {
public var armgun_mc:MovieClip;
}
}//package Space_fla
Section 25
//Eindmenu_17 (Space_fla.Eindmenu_17)
package Space_fla {
import flash.display.*;
public dynamic class Eindmenu_17 extends MovieClip {
public var mainmenu_btn:SimpleButton;
public var retry_btn:SimpleButton;
public var submit_btn:SimpleButton;
}
}//package Space_fla
Section 26
//Hoofdmenu_1 (Space_fla.Hoofdmenu_1)
package Space_fla {
import flash.display.*;
public dynamic class Hoofdmenu_1 extends MovieClip {
public var play_btn:SimpleButton;
}
}//package Space_fla
Section 27
//koehitted_34 (Space_fla.koehitted_34)
package Space_fla {
import flash.display.*;
public dynamic class koehitted_34 extends MovieClip {
public function koehitted_34(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Space_fla
Section 28
//MainTimeline (Space_fla.MainTimeline)
package Space_fla {
import flash.events.*;
import flash.display.*;
import com.*;
import flash.media.*;
import com.fx.*;
import flash.utils.*;
import flash.text.*;
import flash.geom.*;
import com.powerups.*;
import com.vijanden.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var gameThemeChannel:SoundChannel;
public var collisionInterval:Number;
public var waveAantalMax:uint;
public var planetHealth:int;
public var powerupKans:uint;
public var gameThemeTransform:SoundTransform;
public var planeet_mc:MovieClip;
public var gameThemeSound:Game_theme;
public var levelInterval:Number;
public var aantalWaves:uint;
public var score:uint;
public var timerObjecten:Timer;
public var hoofdmenu_mc:MovieClip;
public var lijstVijanden:Array;
public var waveAantal:uint;
public var menuThemeTransform:SoundTransform;
public var waveAantalMin:uint;
public var timerShield:Timer;
public var planet_health_txt:TextField;
public var ID:uint;
public var objectInterval:Number;
public var score_txt:TextField;
public var shieldInterval:Number;
public var duurShieldinSec:uint;
public var shield:ShieldFX;
public var timerCollision:Timer;
public var speler:Speler;
public var menuThemeSound:Hoofdmenu_theme;
public var eindmenu_mc:MovieClip;
public var lijstPowerups:Array;
public var timerLvlProgress:Timer;
public var menuThemeChannel:SoundChannel;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function initialiseerObject(_arg1:Object):void{
_arg1.setStageProperties();
_arg1.bepaalStartpositie();
_arg1.startBeweging();
}
public function bepaalStageQuality(_arg1:uint):void{
var _local2:Stage;
var _local3:uint;
_local2 = stage;
_local3 = _arg1;
if ((((_local3 >= 0)) && ((_local3 < 10)))){
_local2.quality = StageQuality.HIGH;
} else {
if ((((_local3 >= 10)) && ((_local3 < 20)))){
_local2.quality = StageQuality.MEDIUM;
} else {
_local2.quality = StageQuality.LOW;
};
};
}
public function stopGeluidMenu():void{
menuThemeChannel.stop();
}
function frame2(){
stop();
if (Main.startSpel != true){
stopGeluidMenu();
gotoAndStop("hoofdmenu");
} else {
init();
startSpel();
startGeluid();
};
Main.updateScore = function (_arg1:int){
score = (score + _arg1);
score_txt.text = ("Score: " + score);
};
Main.updatePlanetHealth = function (){
planetHealth = Main.getPlanetHealth;
if (planetHealth <= 0){
planetHealth = 0;
verwijderSpel();
};
wijzigPlaneet();
planet_health_txt.text = (("Planet:" + planetHealth) + "%");
};
Main.wijzigPlanetHealth(0);
}
function frame3(){
stop();
eindmenu_mc.retry_btn.addEventListener(MouseEvent.CLICK, retryHandler);
eindmenu_mc.mainmenu_btn.addEventListener(MouseEvent.CLICK, mainmenuHandler);
}
function frame1(){
stop();
startGeluidMenu();
hoofdmenu_mc.play_btn.addEventListener(MouseEvent.CLICK, playHandler);
}
public function verwijderSpel():void{
var _local1:Number;
var _local2:Number;
speler.deleteScene();
timerObjecten.stop();
timerCollision.stop();
timerLvlProgress.stop();
timerObjecten.removeEventListener(TimerEvent.TIMER, respawnObjecten);
timerCollision.removeEventListener(TimerEvent.TIMER, intervalCollision);
timerLvlProgress.removeEventListener(TimerEvent.TIMER, levelProgress);
if (timerShield.hasEventListener(TimerEvent.TIMER)){
removeChild(shield);
timerShield.reset();
timerShield.removeEventListener(TimerEvent.TIMER, shieldPosHandler);
timerShield.removeEventListener(TimerEvent.TIMER_COMPLETE, shieldCompleteHandler);
};
_local1 = 0;
while (_local1 < lijstVijanden.length) {
lijstVijanden[_local1].object.deleteVijand(true);
_local1++;
};
lijstVijanden.splice(0);
_local2 = 0;
while (_local2 < lijstPowerups.length) {
lijstPowerups[_local2].object.deletePowerup();
_local2++;
};
lijstPowerups.splice(0);
stopGeluid();
bepaalStageQuality(0);
Main.startSpel = false;
gotoAndStop("gameover");
}
public function shieldPosHandler(_arg1:TimerEvent):void{
var _local2:Timer;
var _local3:Number;
_local2 = (_arg1.currentTarget as Timer);
_local3 = _local2.currentCount;
if (_local3 >= (30 * (duurShieldinSec - 3))){
if ((_local3 % 3) == 0){
if (shield.alpha == 1){
shield.alpha = 0;
} else {
shield.alpha = 1;
};
};
} else {
shield.alpha = 1;
};
positieShield();
}
public function activeerPowerup(_arg1:String):void{
var _local2:uint;
switch (_arg1){
case "health":
Main.setPlanetHealth = 100;
Main.wijzigPlanetHealth(0);
break;
case "shield":
gebruikShield();
break;
case "bomb":
_local2 = 0;
while (_local2 < lijstVijanden.length) {
lijstVijanden[_local2].object.bombHit = true;
lijstVijanden[_local2].object.gezondheid = 1;
lijstVijanden[_local2].object.updateGezondheid();
_local2++;
};
bepaalStageQuality(lijstVijanden.length);
break;
default:
break;
};
}
public function gebruikShield():void{
if (!timerShield.hasEventListener(TimerEvent.TIMER)){
positieShield();
addChild(shield);
setChildIndex(shield, getChildIndex(speler));
timerShield.addEventListener(TimerEvent.TIMER, shieldPosHandler);
timerShield.addEventListener(TimerEvent.TIMER_COMPLETE, shieldCompleteHandler);
timerShield.start();
} else {
timerShield.reset();
timerShield.start();
};
}
public function startGeluidMenu():void{
menuThemeSound = new Hoofdmenu_theme();
menuThemeChannel = new SoundChannel();
menuThemeChannel = menuThemeSound.play(0, 1);
menuThemeTransform = new SoundTransform();
menuThemeTransform.volume = 1;
menuThemeChannel.soundTransform = menuThemeTransform;
}
public function stopGeluid():void{
gameThemeChannel.stop();
}
public function init():void{
objectInterval = 5000;
collisionInterval = (1000 / 30);
shieldInterval = (1000 / 30);
levelInterval = 1000;
aantalWaves = 0;
waveAantalMin = 1;
waveAantalMax = 1;
powerupKans = 15;
ID = 0;
score = 0;
planetHealth = 100;
lijstVijanden = new Array();
lijstPowerups = new Array();
Main.setScore = score;
Main.setPlanetHealth = planetHealth;
Main.setLijstVijanden = lijstVijanden;
Main.setLijstPowerups = lijstPowerups;
shield = new ShieldFX();
duurShieldinSec = 10;
timerObjecten = new Timer(objectInterval, aantalWaves);
timerCollision = new Timer(collisionInterval, 0);
timerLvlProgress = new Timer(levelInterval, 0);
timerShield = new Timer(shieldInterval, (30 * duurShieldinSec));
timerObjecten.addEventListener(TimerEvent.TIMER, respawnObjecten);
timerCollision.addEventListener(TimerEvent.TIMER, intervalCollision);
timerLvlProgress.addEventListener(TimerEvent.TIMER, levelProgress);
speler = new Speler();
addChild(speler);
speler.init();
score_txt.text = ("Score: " + Main.getScore);
planet_health_txt.text = (("Planet:" + Main.getPlanetHealth) + "%");
planeet_mc.alpha = 1;
bepaalStageQuality(0);
}
public function shieldCompleteHandler(_arg1:TimerEvent):void{
removeChild(shield);
timerShield.reset();
timerShield.removeEventListener(TimerEvent.TIMER, shieldPosHandler);
timerShield.removeEventListener(TimerEvent.TIMER_COMPLETE, shieldCompleteHandler);
}
public function positieShield():void{
var _local1:Number;
var _local2:Number;
_local1 = speler.rotation;
_local2 = ((_local1 * Math.PI) / 180);
shield.x = (300 + (Math.cos(_local2) * (speler.startAfstand + 34)));
shield.y = (300 + (Math.sin(_local2) * (speler.startAfstand + 34)));
}
public function startGeluid():void{
gameThemeSound = new Game_theme();
gameThemeChannel = new SoundChannel();
gameThemeChannel = gameThemeSound.play(0, 0);
gameThemeTransform = new SoundTransform();
gameThemeTransform.volume = 0.5;
gameThemeChannel.soundTransform = gameThemeTransform;
}
public function startSpel():void{
timerObjecten.start();
timerCollision.start();
timerLvlProgress.start();
}
public function respawnObjecten(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:Timer;
var _local4:Number;
var _local5:Number;
var _local6:Array;
var _local7:*;
var _local8:Array;
var _local9:*;
trace("wave");
_local3 = (_arg1.currentTarget as Timer);
_local4 = _local3.currentCount;
if ((_local4 % 10) == 0){
trace("JAAAAAAAAAAAAAAAAAAAAA");
_local2 = 0;
} else {
_local2 = Math.floor((Math.random() * powerupKans));
};
if (_local2 == 0){
_local6 = [{naam:"health", id:ID, object:new Health(1, 1, 0, 1000)}, {naam:"shield", id:ID, object:new Shield(1, 3, 0, 1000)}, {naam:"bomb", id:ID, object:new Bomb(1, 1, 0, 1000)}];
_local7 = _local6[Math.floor((Math.random() * _local6.length))];
addChild(_local7.object);
lijstPowerups.push(_local7);
initialiseerObject(_local7.object);
ID++;
};
waveAantal = (waveAantalMin + Math.round((Math.random() * (waveAantalMax - waveAantalMin))));
_local5 = 0;
while (_local5 < waveAantal) {
_local8 = [{naam:"koe", id:ID, object:new Koe(4, 0.5, 30, 500)}, {naam:"beer", id:ID, object:new Beer(2, 1, 20, 250)}, {naam:"komeet", id:ID, object:new Komeet(1, (2 + Math.round((Math.random() * (4 - 2)))), 10, 100)}];
_local9 = _local8[Math.floor((Math.random() * _local8.length))];
addChild(_local9.object);
lijstVijanden.push(_local9);
initialiseerObject(_local9.object);
ID++;
_local5++;
};
bepaalStageQuality(lijstVijanden.length);
}
public function playHandler(_arg1:MouseEvent):void{
stopGeluidMenu();
Main.startSpel = true;
gotoAndStop("spel");
}
public function retryHandler(_arg1:MouseEvent):void{
Main.startSpel = true;
gotoAndStop("spel");
}
public function mainmenuHandler(_arg1:MouseEvent):void{
Main.startSpel = false;
gotoAndStop("hoofdmenu");
}
public function wijzigPlaneet():void{
if ((((planetHealth >= 1)) && ((planetHealth < 25)))){
planeet_mc.gotoAndStop(4);
} else {
if ((((planetHealth >= 25)) && ((planetHealth < 50)))){
planeet_mc.gotoAndStop(3);
} else {
if ((((planetHealth >= 50)) && ((planetHealth < 75)))){
planeet_mc.gotoAndStop(2);
} else {
if (planetHealth >= 75){
planeet_mc.gotoAndStop(1);
} else {
planeet_mc.alpha = 0;
};
};
};
};
}
public function levelProgress(_arg1:TimerEvent):void{
var _local2:Timer;
var _local3:Number;
_local2 = (_arg1.currentTarget as Timer);
_local3 = _local2.currentCount;
if ((_local3 % 10) == 0){
if (waveAantalMax < 12){
waveAantalMax++;
};
};
if ((_local3 % 20) == 0){
if (powerupKans > 4){
powerupKans--;
};
};
}
public function intervalCollision(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:Point;
var _local5:Point;
_local2 = 0;
while (_local2 < lijstVijanden.length) {
_local4 = new Point(lijstVijanden[_local2].object.x, lijstVijanden[_local2].object.y);
if (speler.hitTestPoint(_local4.x, _local4.y, true)){
if (timerShield.hasEventListener(TimerEvent.TIMER)){
lijstVijanden[_local2].object.spelerHit = true;
lijstVijanden[_local2].object.gezondheid = 1;
lijstVijanden[_local2].object.updateGezondheid();
} else {
lijstVijanden[_local2].object.spelerHit = true;
lijstVijanden[_local2].object.gezondheid = 1;
lijstVijanden[_local2].object.updateGezondheid();
verwijderSpel();
break;
};
};
_local2++;
};
_local3 = 0;
while (_local3 < lijstPowerups.length) {
_local5 = new Point(lijstPowerups[_local3].object.x, lijstPowerups[_local3].object.y);
if (speler.hitTestPoint(_local5.x, _local5.y)){
lijstPowerups[_local3].object.spelerHitByPowerup = true;
activeerPowerup(lijstPowerups[_local3].naam);
lijstPowerups[_local3].object.updateGezondheid();
};
_local3++;
};
}
}
}//package Space_fla
Section 29
//Planet_6 (Space_fla.Planet_6)
package Space_fla {
import flash.display.*;
public dynamic class Planet_6 extends MovieClip {
public function Planet_6(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package Space_fla
Section 30
//preview1_15 (Space_fla.preview1_15)
package Space_fla {
import flash.display.*;
public dynamic class preview1_15 extends MovieClip {
public function preview1_15(){
addFrameScript(44, frame45);
}
function frame45(){
stop();
}
}
}//package Space_fla
Section 31
//Drol (Drol)
package {
import flash.display.*;
public dynamic class Drol extends MovieClip {
}
}//package
Section 32
//Game_theme (Game_theme)
package {
import flash.media.*;
public dynamic class Game_theme extends Sound {
}
}//package
Section 33
//Hoofdmenu_theme (Hoofdmenu_theme)
package {
import flash.media.*;
public dynamic class Hoofdmenu_theme extends Sound {
}
}//package