Section 1
//ReflexiveAPI (com.reflexive.ReflexiveAPI)
package com.reflexive {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
public class ReflexiveAPI extends Sprite {
private var connected:Boolean;
private var connectionString:String;
private var scoreTimer:Timer;
private var useAPI:Boolean;
private var oldMouseY:Number;
private var lastScore;// = null
private var oldMouseX:Number;
private var updateActivity:Boolean;// = false
private var conn:LocalConnection;
private var activityTimer:Timer;
private static var obj:ReflexiveAPI;
public function ReflexiveAPI(){
addEventListener(Event.ADDED_TO_STAGE, onLoad);
}
public function setMedalSchedule(_arg1:String, _arg2, _arg3, _arg4, _arg5):void{
if (useAPI){
if (!connected){
setTimeout(setMedalSchedule, 500, _arg1, _arg2, _arg3, _arg4, _arg5);
} else {
conn.send(connectionString, "setMedalSchedule", _arg1, _arg2, _arg3, _arg4, _arg5);
};
};
}
private function initConnection():void{
if (useAPI){
if (!connected){
conn.send(connectionString, "initToolbar");
setTimeout(initConnection, 500);
};
};
}
public function setIsActive():void{
if (useAPI){
if (!connected){
setTimeout(setIsActive, 500);
} else {
conn.send(connectionString, "setIsActive", null);
};
};
}
private function onLoad(_arg1:Event):void{
connected = false;
useAPI = (int(root.loaderInfo.parameters.useReflexiveAPI) == 1);
if (useAPI){
connectionString = root.loaderInfo.parameters.connectionString;
conn = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS, onStatus);
conn.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
initConnection();
root.addEventListener(Event.ENTER_FRAME, checkActivity);
scoreTimer = new Timer(1000);
scoreTimer.addEventListener(TimerEvent.TIMER, submitScoreHelper);
scoreTimer.start();
activityTimer = new Timer(5000);
activityTimer.addEventListener(TimerEvent.TIMER, sendActivity);
activityTimer.start();
};
}
private function submitScoreHelper(_arg1:TimerEvent):void{
if (((((useAPI) && (connected))) && (!((lastScore == null))))){
conn.send(connectionString, "submitScore", lastScore);
lastScore = null;
};
}
public function submitScore(_arg1):void{
if (useAPI){
lastScore = _arg1;
};
}
private function onAsyncError(_arg1:AsyncErrorEvent):void{
}
private function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "status":
connected = true;
break;
case "error":
break;
};
}
private function checkActivity(_arg1:Event):void{
if (((!((mouseX == oldMouseX))) || (!((mouseY == oldMouseY))))){
oldMouseX = mouseX;
oldMouseY = mouseY;
updateActivity = true;
};
}
private function sendActivity(_arg1:TimerEvent):void{
if (updateActivity){
setIsActive();
};
updateActivity = false;
}
public static function getInstance():ReflexiveAPI{
if (obj == null){
obj = new (ReflexiveAPI);
};
return (obj);
}
}
}//package com.reflexive
Section 2
//BoosterCount (BoosterCount)
package {
import flash.display.*;
public dynamic class BoosterCount extends MovieClip {
}
}//package
Section 3
//BoosterThrust (BoosterThrust)
package {
import flash.media.*;
public dynamic class BoosterThrust extends Sound {
}
}//package
Section 4
//Comet (Comet)
package {
import flash.display.*;
public dynamic class Comet extends MovieClip {
public var m_gameController:SpaceBoy;
public var m_velocityX:Number;
public var m_velocityY:Number;
public function Comet(_arg1:SpaceBoy, _arg2:Number, _arg3:Number, _arg4:Number){
m_gameController = _arg1;
x = _arg2;
y = _arg3;
rotation = _arg4;
m_velocityX = (-(Math.cos((rotation * 0.0174532925))) * 32);
m_velocityY = (-(Math.sin((rotation * 0.0174532925))) * 32);
}
public function update(_arg1:Number):void{
x = (x + (m_velocityX * _arg1));
y = (y + (m_velocityY * _arg1));
}
}
}//package
Section 5
//CometCollected (CometCollected)
package {
import flash.media.*;
public dynamic class CometCollected extends Sound {
}
}//package
Section 6
//Continue (Continue)
package {
import flash.display.*;
public dynamic class Continue extends SimpleButton {
}
}//package
Section 7
//EngineThrust (EngineThrust)
package {
import flash.display.*;
public dynamic class EngineThrust extends MovieClip {
}
}//package
Section 8
//GameBackground (GameBackground)
package {
import flash.display.*;
public dynamic class GameBackground extends MovieClip {
}
}//package
Section 9
//GameHud (GameHud)
package {
import flash.display.*;
import flash.text.*;
public class GameHud extends MovieClip {
public var getFreeGamesButton:SimpleButton;
public var boosterCount:BoosterCount;
public var m_score:int;// = 0
public var m_boosters:int;// = 3
public var score:Score;
public function GameHud(){
var _local1:MovieClip;
var _local2:TextField;
var _local3:MovieClip;
var _local4:TextField;
m_boosters = 3;
m_score = 0;
super();
_local1 = (getChildByName("boosterCount") as MovieClip);
_local2 = (_local1.getChildAt(0) as TextField);
_local2.text = String(m_boosters);
_local3 = (getChildByName("score") as MovieClip);
_local4 = (_local3.getChildAt(0) as TextField);
_local4.text = String(m_score);
}
public function UseBooster():Boolean{
var _local1:MovieClip;
var _local2:TextField;
if (m_boosters <= 0){
return (false);
};
m_boosters--;
_local1 = (getChildByName("boosterCount") as MovieClip);
_local2 = (_local1.getChildAt(0) as TextField);
_local2.text = String(m_boosters);
return (true);
}
public function AccumulateScore(_arg1:SpaceBoy, _arg2:int){
var _local3:MovieClip;
var _local4:TextField;
m_score = (m_score + _arg2);
_local3 = (getChildByName("score") as MovieClip);
_local4 = (_local3.getChildAt(0) as TextField);
_local4.text = String(m_score);
_arg1.m_reflexiveAPI.submitScore(m_score);
}
public function AddBooster():void{
var _local1:MovieClip;
var _local2:TextField;
m_boosters++;
_local1 = (getChildByName("boosterCount") as MovieClip);
_local2 = (_local1.getChildAt(0) as TextField);
_local2.text = String(m_boosters);
}
}
}//package
Section 10
//GameOver (GameOver)
package {
import flash.display.*;
public dynamic class GameOver extends MovieClip {
public var playButton:PlayAgain;
public var onYourSiteButton:Quit;
public var moreGamesButton:MoreGames;
}
}//package
Section 11
//GetStar1 (GetStar1)
package {
import flash.media.*;
public dynamic class GetStar1 extends Sound {
}
}//package
Section 12
//GetStar2 (GetStar2)
package {
import flash.media.*;
public dynamic class GetStar2 extends Sound {
}
}//package
Section 13
//GetStar3 (GetStar3)
package {
import flash.media.*;
public dynamic class GetStar3 extends Sound {
}
}//package
Section 14
//GetStar4 (GetStar4)
package {
import flash.media.*;
public dynamic class GetStar4 extends Sound {
}
}//package
Section 15
//GotoUrlEventHandler (GotoUrlEventHandler)
package {
import flash.events.*;
import flash.net.*;
public class GotoUrlEventHandler {
public var m_url:String;
public function GotoUrlEventHandler(_arg1:String){
this.m_url = _arg1;
}
public function handler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest(m_url));
}
}
}//package
Section 16
//HitGround (HitGround)
package {
import flash.media.*;
public dynamic class HitGround extends Sound {
}
}//package
Section 17
//Input (Input)
package {
import flash.events.*;
import flash.display.*;
public class Input {
private var keyArr:Array;
private var keyBuffer:Array;
public var mouseReleased:Boolean;// = false
public var mouseDragY:Number;// = 0
public var mouseOver:Boolean;// = false
public var mouse:Sprite;
public var timeSinceLastKey;// = 0
public var mousePressed:Boolean;// = false
public var mouseOffsetX:Number;// = 0
public var mouseOffsetY:Number;// = 0
public var ascii:Array;
public var mouseX:Number;// = 0
public var mouseY:Number;// = 0
private var bufferSize:int;
public var m_stageMc:Sprite;
public var mouseDown:Boolean;// = false
public var lastKey:int;// = 0
private var keyState:Array;
public var mouseDragX:Number;// = 0
public function Input(_arg1:Sprite){
var _local2:int;
var _local3:int;
lastKey = 0;
timeSinceLastKey = 0;
mouseDown = false;
mouseReleased = false;
mousePressed = false;
mouseOver = false;
mouseX = 0;
mouseY = 0;
mouseOffsetX = 0;
mouseOffsetY = 0;
mouseDragX = 0;
mouseDragY = 0;
mouse = new Sprite();
super();
m_stageMc = _arg1;
ascii = new Array(222);
fillAscii();
keyState = new Array(222);
keyArr = new Array();
_local2 = 0;
while (_local2 < 222) {
keyState[_local2] = new int(0);
if (ascii[_local2] != undefined){
keyArr.push(_local2);
};
_local2++;
};
bufferSize = 5;
keyBuffer = new Array(bufferSize);
_local3 = 0;
while (_local3 < bufferSize) {
keyBuffer[_local3] = new Array(0, 0);
_local3++;
};
_arg1.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress, false, 0, true);
_arg1.stage.addEventListener(KeyboardEvent.KEY_UP, keyRelease, false, 0, true);
_arg1.stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true);
_arg1.stage.addEventListener(MouseEvent.CLICK, mouseRelease, false, 0, true);
_arg1.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true);
_arg1.stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave, false, 0, true);
mouse.graphics.lineStyle(0.1, 0, 100);
mouse.graphics.moveTo(0, 0);
mouse.graphics.lineTo(0, 0.1);
}
public function getKeyHold(_arg1:int):int{
return (Math.max(0, keyState[_arg1]));
}
public function isKeyPressed(_arg1:int):Boolean{
timeSinceLastKey = 0;
return ((keyState[_arg1] == 1));
}
private function fillAscii(){
ascii[65] = "A";
ascii[66] = "B";
ascii[67] = "C";
ascii[68] = "D";
ascii[69] = "E";
ascii[70] = "F";
ascii[71] = "G";
ascii[72] = "H";
ascii[73] = "I";
ascii[74] = "J";
ascii[75] = "K";
ascii[76] = "L";
ascii[77] = "M";
ascii[78] = "N";
ascii[79] = "O";
ascii[80] = "P";
ascii[81] = "Q";
ascii[82] = "R";
ascii[83] = "S";
ascii[84] = "T";
ascii[85] = "U";
ascii[86] = "V";
ascii[87] = "W";
ascii[88] = "X";
ascii[89] = "Y";
ascii[90] = "Z";
ascii[48] = "0";
ascii[49] = "1";
ascii[50] = "2";
ascii[51] = "3";
ascii[52] = "4";
ascii[53] = "5";
ascii[54] = "6";
ascii[55] = "7";
ascii[56] = "8";
ascii[57] = "9";
ascii[32] = "Spacebar";
ascii[17] = "Ctrl";
ascii[16] = "Shift";
ascii[192] = "~";
ascii[38] = "up";
ascii[40] = "down";
ascii[37] = "left";
ascii[39] = "right";
ascii[96] = "Numpad 0";
ascii[97] = "Numpad 1";
ascii[98] = "Numpad 2";
ascii[99] = "Numpad 3";
ascii[100] = "Numpad 4";
ascii[101] = "Numpad 5";
ascii[102] = "Numpad 6";
ascii[103] = "Numpad 7";
ascii[104] = "Numpad 8";
ascii[105] = "Numpad 9";
ascii[111] = "Numpad /";
ascii[106] = "Numpad *";
ascii[109] = "Numpad -";
ascii[107] = "Numpad +";
ascii[110] = "Numpad .";
ascii[45] = "Insert";
ascii[46] = "Delete";
ascii[33] = "Page Up";
ascii[34] = "Page Down";
ascii[35] = "End";
ascii[36] = "Home";
ascii[112] = "F1";
ascii[113] = "F2";
ascii[114] = "F3";
ascii[115] = "F4";
ascii[116] = "F5";
ascii[117] = "F6";
ascii[118] = "F7";
ascii[119] = "F8";
ascii[188] = ",";
ascii[190] = ".";
ascii[186] = ";";
ascii[222] = "'";
ascii[219] = "[";
ascii[221] = "]";
ascii[189] = "-";
ascii[187] = "+";
ascii[220] = "\\";
ascii[191] = "/";
ascii[9] = "TAB";
ascii[8] = "Backspace";
}
public function mouseLeave(_arg1:Event){
mouseReleased = mouseDown;
mouseDown = false;
}
public function mouseMove(_arg1:MouseEvent){
if (mouseDown != _arg1.buttonDown){
mouseDown = _arg1.buttonDown;
mouseReleased = !(_arg1.buttonDown);
mousePressed = _arg1.buttonDown;
mouseDragX = 0;
mouseDragY = 0;
};
mouseX = (_arg1.stageX - m_stageMc.x);
mouseY = (_arg1.stageY - m_stageMc.y);
mouseOffsetX = (mouseX - mouse.x);
mouseOffsetY = (mouseY - mouse.y);
if (mouseDown){
mouseDragX = (mouseDragX + mouseOffsetX);
mouseDragY = (mouseDragY + mouseOffsetY);
};
mouse.x = mouseX;
mouse.y = mouseY;
}
public function isKeyDown(_arg1:int):Boolean{
return ((keyState[_arg1] > 0));
}
public function getKeyString(_arg1:uint):String{
return (ascii[_arg1]);
}
public function mousePress(_arg1:MouseEvent){
mousePressed = true;
mouseDown = true;
mouseDragX = 0;
mouseDragY = 0;
}
public function mouseRelease(_arg1:MouseEvent){
mouseDown = false;
mouseReleased = true;
}
public function keyPress(_arg1:KeyboardEvent){
keyState[_arg1.keyCode] = Math.max(keyState[_arg1.keyCode], 1);
lastKey = _arg1.keyCode;
}
public function keyRelease(_arg1:KeyboardEvent){
var _local2:int;
keyState[_arg1.keyCode] = -1;
_local2 = (bufferSize - 1);
while (_local2 > 0) {
keyBuffer[_local2] = keyBuffer[(_local2 - 1)];
_local2--;
};
keyBuffer[0] = [_arg1.keyCode, 0];
}
public function isKeyReleased(_arg1:int):Boolean{
return ((keyState[_arg1] == -1));
}
public function isKeyInBuffer(_arg1:int, _arg2:int, _arg3:int){
return ((((keyBuffer[_arg2][0] == _arg1)) && ((keyBuffer[_arg2][1] <= _arg3))));
}
public function update(){
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < keyArr.length) {
if (keyState[keyArr[_local1]] != 0){
var _local3 = keyState;
var _local4 = keyArr[_local1];
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
};
_local1++;
};
_local2 = 0;
while (_local2 < bufferSize) {
_local3 = keyBuffer[_local2];
_local4 = 1;
_local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
_local2++;
};
mouseReleased = false;
mousePressed = false;
mouseOver = false;
}
}
}//package
Section 18
//IntroMovieButton (IntroMovieButton)
package {
import flash.display.*;
public dynamic class IntroMovieButton extends SimpleButton {
}
}//package
Section 19
//LoopingMusic (LoopingMusic)
package {
import flash.media.*;
public dynamic class LoopingMusic extends Sound {
}
}//package
Section 20
//MainCharacter (MainCharacter)
package {
import flash.display.*;
import flash.geom.*;
public class MainCharacter extends MovieClip {
public var m_isInsideTractorBeam:Boolean;// = false
public var m_secondsAlive:Number;// = 0
public var m_altitude:Number;// = 0
public var m_state:String;// = "on_ground"
public var m_flyingFrame:Number;// = 0
var m_colorTransform:ColorTransform;
public var m_thrustTimeRemaining:Number;// = 0
public var m_launchingFrame:Number;// = 0
public var m_landingFrame:Number;// = 0
public var m_boosterTimeRemaining:Number;// = 0
public var m_isOnGround;// = true
public var m_onGroundTime:Number;// = 0
public var m_velocityY;// = 0
public var m_engineThrust:MovieClip;
public function MainCharacter(){
m_altitude = 0;
m_velocityY = 0;
m_isOnGround = true;
m_thrustTimeRemaining = 0;
m_boosterTimeRemaining = 0;
m_state = "on_ground";
m_launchingFrame = 0;
m_flyingFrame = 0;
m_landingFrame = 0;
m_onGroundTime = 0;
m_isInsideTractorBeam = false;
m_secondsAlive = 0;
super();
gotoAndStop(0);
x = 200;
m_engineThrust = new EngineThrust();
addChild(m_engineThrust);
m_engineThrust.x = -16;
m_engineThrust.y = -5;
m_engineThrust.scaleY = 0;
m_colorTransform = this.transform.colorTransform;
}
public function updateDoFlying(_arg1:SpaceBoy, _arg2:Number){
var _local3:*;
var _local4:*;
_local3 = 4;
_local4 = ((_arg1.m_input.mouseX - x) / 20);
if (_local4 > _local3){
_local4 = _local3;
} else {
if (_local4 < -(_local3)){
_local4 = -(_local3);
};
};
if (m_isInsideTractorBeam){
_local4 = (_local4 * 0.4);
};
x = (x + _local4);
rotation = ((_local4 * 4) - 5);
m_flyingFrame = Math.floor((70 - ((m_velocityY / 200) * 30)));
if (m_flyingFrame > 76){
m_flyingFrame = 76;
} else {
if (m_flyingFrame < 25){
m_flyingFrame = 25;
};
};
gotoAndStop(m_flyingFrame);
m_thrustTimeRemaining = (m_thrustTimeRemaining - _arg2);
if (m_thrustTimeRemaining < 0){
m_thrustTimeRemaining = 0;
};
m_boosterTimeRemaining = (m_boosterTimeRemaining - _arg2);
if (m_boosterTimeRemaining < 0){
m_boosterTimeRemaining = 0;
};
if (((((_arg1.m_input.mousePressed) && ((m_boosterTimeRemaining <= 0)))) && (_arg1.m_hud.UseBooster()))){
m_boosterTimeRemaining = 2;
m_isOnGround = false;
new BoosterThrust().play();
if (m_velocityY < 0){
m_velocityY = 0;
};
};
if ((((m_boosterTimeRemaining > 0)) || ((m_thrustTimeRemaining > 0)))){
m_velocityY = (m_velocityY + (600 * _arg2));
if (m_velocityY > 150){
m_velocityY = 150;
};
};
m_velocityY = (m_velocityY - (_arg1.m_gravity * _arg2));
m_altitude = (m_altitude + (m_velocityY * _arg2));
m_engineThrust.scaleY = Math.min((Math.min((m_thrustTimeRemaining * 4), 1) + Math.min((m_boosterTimeRemaining * 1.5), 2.5)), 4.5);
m_engineThrust.gotoAndStop(Math.floor(((Math.random() * 5) + 1)));
m_engineThrust.rotation = ((Math.random() * 3) - 1.5);
if (m_altitude <= 0){
m_isOnGround = true;
m_velocityY = 0;
m_altitude = 0;
m_landingFrame = m_flyingFrame;
new HitGround().play();
m_state = "landing";
};
}
public function CollectedComet(){
m_boosterTimeRemaining = 3;
new CometCollected().play();
m_velocityY = 300;
}
public function update(_arg1:SpaceBoy, _arg2:Number){
m_secondsAlive = (m_secondsAlive + _arg2);
switch (m_state){
case "on_ground":
m_onGroundTime = (m_onGroundTime + _arg2);
m_launchingFrame = ((Math.sin((m_onGroundTime * 6)) * 4) + 4);
gotoAndStop(Math.floor(m_launchingFrame));
if (_arg1.m_input.mousePressed){
m_state = "launching";
};
break;
case "launching":
m_launchingFrame = (m_launchingFrame + (_arg2 * 40));
gotoAndStop(Math.floor(m_launchingFrame));
if (m_launchingFrame > 24){
_arg1.m_hud.UseBooster();
m_boosterTimeRemaining = 2;
m_isOnGround = false;
m_velocityY = 350;
new BoosterThrust().play();
m_state = "flying";
};
break;
case "flying":
updateDoFlying(_arg1, _arg2);
break;
case "landing":
m_landingFrame = (m_landingFrame + (_arg2 * 40));
gotoAndStop(Math.floor(m_landingFrame));
if (m_landingFrame > 100){
m_landingFrame = 100;
_arg1.setState("gameOver");
m_state = "gameOver";
};
break;
case "gameOver":
break;
};
y = ((_arg1.stage.stageHeight - _arg1.m_groundY) - m_altitude);
if (m_isInsideTractorBeam){
m_colorTransform.redMultiplier = 0;
m_colorTransform.greenMultiplier = ((Math.cos((m_secondsAlive * 10)) * 0.5) + 1);
m_colorTransform.blueMultiplier = (Math.sin((m_secondsAlive * 30)) + 2);
transform.colorTransform = m_colorTransform;
} else {
m_colorTransform.redMultiplier = 1;
m_colorTransform.greenMultiplier = 1;
m_colorTransform.blueMultiplier = 1;
transform.colorTransform = m_colorTransform;
};
m_isInsideTractorBeam = false;
}
public function InsideTractorBeam(){
m_isInsideTractorBeam = true;
m_velocityY = (m_velocityY * 0.8);
}
public function BashedSatellite(){
y = (y + 8);
m_velocityY = (m_velocityY - 50);
}
public function CollectedInstantThrust(){
m_thrustTimeRemaining = 1.25;
new StarThrust().play();
if (m_velocityY < 0){
m_velocityY = 0;
};
}
}
}//package
Section 21
//MainMenu (MainMenu)
package {
import flash.display.*;
public dynamic class MainMenu extends MovieClip {
public var reflexiveButton:SimpleButton;
public var getFreeGamesButton:SimpleButton;
public var playButton:PlayButton;
public var onYourSiteButton:Quit;
public var moreGamesButton:MoreGames;
}
}//package
Section 22
//MoreGames (MoreGames)
package {
import flash.display.*;
public dynamic class MoreGames extends SimpleButton {
}
}//package
Section 23
//Particle (Particle)
package {
import flash.display.*;
public class Particle extends Sprite {
public var m_colorHue:Number;
public var m_gameController:SpaceBoy;
public var m_colorLightness:Number;
public var m_colorLightnessVelocity:Number;
public var m_size:Number;
public var m_remainingLifeTime:Number;
public var m_colorSaturation:Number;
public var m_velocityX:Number;
public var m_velocityY:Number;
public function Particle(_arg1:SpaceBoy, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number){
m_gameController = _arg1;
x = _arg2;
y = _arg3;
m_velocityX = (Math.cos(_arg4) * _arg5);
m_velocityY = (Math.sin(_arg4) * _arg5);
m_colorHue = _arg6;
m_colorSaturation = _arg7;
m_colorLightness = _arg8;
m_remainingLifeTime = _arg10;
m_colorLightnessVelocity = ((_arg9 - _arg8) / _arg10);
m_size = _arg11;
}
public function convertHSLtoRGB(_arg1:Number, _arg2:Number, _arg3:Number):int{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg2 == 0){
_local4 = _arg3;
_local5 = _arg3;
_local6 = _arg3;
} else {
if (_arg3 < 0.5){
_local7 = (_arg3 * (1 + _arg2));
} else {
_local7 = ((_arg3 + _arg2) - (_arg2 * _arg3));
};
_local8 = ((2 * _arg3) - _local7);
_local4 = hueToRGB(_local8, _local7, (_arg1 + (1 / 3)));
_local5 = hueToRGB(_local8, _local7, _arg1);
_local6 = hueToRGB(_local8, _local7, (_arg1 - (1 / 3)));
};
return (((((_local4 * 0xFF) << 16) | ((_local5 * 0xFF) << 8)) | (_local6 * 0xFF)));
}
public function hueToRGB(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg3 < 0){
_arg3 = (_arg3 + 1);
};
if (_arg3 > 1){
_arg3--;
};
if ((6 * _arg3) < 1){
return ((_arg1 + (((_arg2 - _arg1) * 6) * _arg3)));
};
if ((2 * _arg3) < 1){
return (_arg2);
};
if ((3 * _arg3) < 2){
return ((_arg1 + (((_arg2 - _arg1) * ((2 / 3) - _arg3)) * 6)));
};
return (_arg1);
}
public function update(_arg1:Number):void{
graphics.clear();
graphics.lineStyle(m_size, convertHSLtoRGB(m_colorHue, m_colorSaturation, m_colorLightness), 1, false, "normal", null, null, 30);
graphics.moveTo(0, 0);
graphics.lineTo((m_velocityX * _arg1), (m_velocityY * _arg1));
x = (x + (m_velocityX * _arg1));
y = (y + (m_velocityY * _arg1));
m_velocityY = (m_velocityY + (98 * _arg1));
m_velocityX = (m_velocityX * 0.8);
m_velocityY = (m_velocityY * 0.8);
m_colorLightness = (m_colorLightness - (m_colorLightnessVelocity * _arg1));
m_remainingLifeTime = (m_remainingLifeTime - (1 * _arg1));
}
}
}//package
Section 24
//Planet (Planet)
package {
import flash.display.*;
public dynamic class Planet extends MovieClip {
}
}//package
Section 25
//PlayAgain (PlayAgain)
package {
import flash.display.*;
public dynamic class PlayAgain extends SimpleButton {
}
}//package
Section 26
//PlayButton (PlayButton)
package {
import flash.display.*;
public dynamic class PlayButton extends SimpleButton {
}
}//package
Section 27
//Quit (Quit)
package {
import flash.display.*;
public dynamic class Quit extends SimpleButton {
}
}//package
Section 28
//ReflexiveIntroMovie (ReflexiveIntroMovie)
package {
import flash.display.*;
public dynamic class ReflexiveIntroMovie extends MovieClip {
public var introMovieButton:IntroMovieButton;
public function ReflexiveIntroMovie(){
addFrameScript(59, frame60);
}
function frame60(){
stop();
}
}
}//package
Section 29
//Satellite (Satellite)
package {
import flash.display.*;
public class Satellite extends MovieClip {
public var m_gameController:SpaceBoy;
public var m_velocityX:Number;
public var m_velocityY:Number;
public function Satellite(_arg1:SpaceBoy, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:Number;
super();
m_gameController = _arg1;
x = _arg2;
y = _arg3;
rotation = (_arg4 + 180);
_local5 = (64 + (-(_arg3) / 400));
m_velocityX = (-(Math.cos((_arg4 * 0.0174532925))) * _local5);
m_velocityY = (-(Math.sin((_arg4 * 0.0174532925))) * _local5);
}
public function update(_arg1:Number):void{
x = (x + (m_velocityX * _arg1));
y = (y + (m_velocityY * _arg1));
}
}
}//package
Section 30
//SatelliteAppears (SatelliteAppears)
package {
import flash.media.*;
public dynamic class SatelliteAppears extends Sound {
}
}//package
Section 31
//SatelliteHit (SatelliteHit)
package {
import flash.media.*;
public dynamic class SatelliteHit extends Sound {
}
}//package
Section 32
//Saucer (Saucer)
package {
import flash.display.*;
public class Saucer extends MovieClip {
public var m_isTractorBeamActive:Boolean;// = true
public var m_gameController:SpaceBoy;
public var m_secondsSinceItemInsideTractorBeam:Number;// = 0
public var m_tractorBeam:MovieClip;
public var m_velocityX:Number;
public var m_velocityY:Number;
public var m_hadItemInsideTractorBeam:Boolean;// = false
public function Saucer(_arg1:SpaceBoy, _arg2:Number, _arg3:Number){
var _local4:Number;
m_hadItemInsideTractorBeam = false;
m_secondsSinceItemInsideTractorBeam = 0;
m_isTractorBeamActive = true;
super();
m_gameController = _arg1;
x = _arg2;
y = _arg3;
_local4 = (64 + (-(_arg3) / 400));
m_velocityX = 0;
m_velocityY = 20;
m_tractorBeam = new TractorBeam();
addChild(m_tractorBeam);
}
public function HasItemInsideTractorBeam():void{
if (!m_hadItemInsideTractorBeam){
m_hadItemInsideTractorBeam = true;
m_velocityY = 0;
};
}
public function update(_arg1:Number):void{
x = (x + (m_velocityX * _arg1));
y = (y + (m_velocityY * _arg1));
if (m_hadItemInsideTractorBeam){
m_secondsSinceItemInsideTractorBeam = (m_secondsSinceItemInsideTractorBeam + _arg1);
if (m_secondsSinceItemInsideTractorBeam > 1){
if (m_isTractorBeamActive){
removeChild(m_tractorBeam);
};
m_isTractorBeamActive = false;
m_velocityX = 1000;
} else {
m_velocityY = -8;
};
};
}
}
}//package
Section 33
//Score (Score)
package {
import flash.display.*;
public dynamic class Score extends MovieClip {
}
}//package
Section 34
//ScrollingGameBackground (ScrollingGameBackground)
package {
import flash.display.*;
public class ScrollingGameBackground extends MovieClip {
public var m_gameController:SpaceBoy;
public var m_planetsArray:Array;
public var m_backgroundLayer:MovieClip;
public function ScrollingGameBackground(_arg1:SpaceBoy){
var _local2:int;
super();
m_gameController = _arg1;
x = 0;
y = 0;
m_backgroundLayer = new GameBackground();
m_backgroundLayer.y = _arg1.stage.stageHeight;
addChild(m_backgroundLayer);
_local2 = -600;
while (_local2 > -15500) {
addStarCluster(Math.floor((Math.random() * 3)), _local2);
_local2 = (_local2 - 600);
};
addPlanet(1, 120, -1400);
addPlanet(2, 450, -3000);
addPlanet(3, 400, -3700);
addPlanet(4, 100, -4300);
addPlanet(5, 400, -5000);
addPlanet(2, 400, -5450);
addPlanet(4, 400, -5900);
addPlanet(5, 80, -6400);
addPlanet(2, 120, -6800);
addPlanet(4, 500, -7200);
addPlanet(2, 440, -7800);
addPlanet(4, 40, -8500);
addPlanet(2, 500, -9000);
addPlanet(5, 140, -10000);
addPlanet(2, 400, -12000);
addPlanet(3, 80, -13000);
}
public function addPlanet(_arg1:int, _arg2:Number, _arg3:Number):void{
var _local4:MovieClip;
_local4 = new Planet();
_local4.gotoAndStop(_arg1);
_local4.x = _arg2;
_local4.y = _arg3;
addChild(_local4);
}
public function update(_arg1:SpaceBoy, _arg2:Number):void{
}
public function addStarCluster(_arg1:int, _arg2:Number):void{
var _local3:MovieClip;
_local3 = new StarCluster();
_local3.gotoAndStop(_arg1);
_local3.y = _arg2;
addChild(_local3);
}
}
}//package
Section 35
//SpaceBoy (SpaceBoy)
package {
import flash.events.*;
import flash.display.*;
import com.reflexive.*;
import flash.media.*;
import flash.utils.*;
public class SpaceBoy extends MovieClip {
public var m_minDistanceBetweenStarsInitial:Number;// = 50
private var m_getFreeGamesFromHud:GotoUrlEventHandler;
public var m_framesPerSecond:Number;// = 40
public var m_hud:GameHud;
public var m_particleLayer:Sprite;
public var m_maxDistanceBetweenSatellitesInitial:Number;// = 1000
public var m_loopingMusicChannel:SoundChannel;
public var m_state:String;// = "undefined"
public var m_scoreBonusPerStar:int;// = 10
public var m_minDistanceBetweenSaucers:Number;
public var m_starsCollectableLayer:Sprite;
public var m_reflexiveAPI:ReflexiveAPI;
private var m_mainMenu:MovieClip;
public var m_scrollingLayer:ScrollingGameBackground;
private var m_onYourSiteFromMainMenu:GotoUrlEventHandler;
public var m_gravity;// = 300
public var m_nextCometHeight:Number;
public var m_loopingMusic:Sound;
public var m_scoreBasePerStar:int;// = 100
public var m_scorePerStar:int;
private var m_getFreeGamesFromMainMenu:GotoUrlEventHandler;
private var m_moreGamesFromMainMenu:GotoUrlEventHandler;
public var m_maxDistanceBetweenSatellites:Number;
public var m_cometsCollectableLayer:Sprite;
public var m_minDistanceBetweenSaucersInitial:Number;// = 500
public var m_loopingMusicVolume:Number;
private var m_reflexiveFromMainMenu:GotoUrlEventHandler;
public var m_minDistanceBetweenSatellitesInitial:Number;// = 500
public var m_maxDistanceBetweenSaucersInitial:Number;// = 1000
public var m_mainCharacter:MovieClip;
public var m_minDistanceBetweenComets:Number;
public var m_starDistributionArrayArray:Array;
private var m_introMovie:MovieClip;
private var m_needsCleanUpAfterPlay:Boolean;// = false
public var m_maxDistanceBetweenComets:Number;
public var m_minDistanceBetweenCometsInitial:Number;// = 800
public var m_minDistanceBetweenStars:Number;
public var m_maxDistanceBetweenCometsInitial:Number;// = 1500
private var m_reflexiveFromIntroMovie:GotoUrlEventHandler;
public var m_input:Input;
public var m_saucersLayer:Sprite;
private var m_onYourSiteFromGameOver:GotoUrlEventHandler;
private var m_gameOver:MovieClip;
public var m_nextStarHeight:Number;
public var m_maxDistanceBetweenStars:Number;
public var m_removeStarsBelowDistance:Number;// = 1500
public var m_starParticleDefinitions:Array;
public var m_maxDistanceBetweenStarsInitial:Number;// = 80
private var m_introMovieTimer:Timer;
public var m_playSatelliteHitSoundTimeout:Number;// = 0
public var m_minDistanceBetweenSatellites:Number;
public var m_nextSaucerHeight:Number;
public var m_satellitesLayer:Sprite;
public var m_groundY:Number;// = 70
public var m_maxDistanceBetweenSaucers:Number;
public var m_maxGameHeight:Number;// = 16000
private var m_moreGamesFromGameOver:GotoUrlEventHandler;
public var m_nextSatelliteHeight:Number;
public function SpaceBoy(){
m_framesPerSecond = 40;
m_groundY = 70;
m_minDistanceBetweenStarsInitial = 50;
m_maxDistanceBetweenStarsInitial = 80;
m_removeStarsBelowDistance = 1500;
m_minDistanceBetweenCometsInitial = 800;
m_maxDistanceBetweenCometsInitial = 1500;
m_minDistanceBetweenSatellitesInitial = 500;
m_maxDistanceBetweenSatellitesInitial = 1000;
m_playSatelliteHitSoundTimeout = 0;
m_minDistanceBetweenSaucersInitial = 500;
m_maxDistanceBetweenSaucersInitial = 1000;
m_scoreBasePerStar = 100;
m_scoreBonusPerStar = 10;
m_maxGameHeight = 16000;
m_starParticleDefinitions = new Array();
m_gravity = 300;
m_state = "undefined";
m_needsCleanUpAfterPlay = false;
m_moreGamesFromMainMenu = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameHome&REFERRER=JumpStar&SOURCE=MainMenu");
m_reflexiveFromMainMenu = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameHome&REFERRER=JumpStar&SOURCE=MainMenuReflexiveLogo");
m_reflexiveFromIntroMovie = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameHome&REFERRER=JumpStar&SOURCE=IntroMovie");
m_moreGamesFromGameOver = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameHome&REFERRER=JumpStar&SOURCE=GameOver");
m_getFreeGamesFromMainMenu = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameHome&REFERRER=JumpStar&SOURCE=MainMenu");
m_getFreeGamesFromHud = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameHome&REFERRER=JumpStar&SOURCE=InGame");
m_onYourSiteFromMainMenu = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameForMySite&REFERRER=JumpStar&SOURCE=MainMenu");
m_onYourSiteFromGameOver = new GotoUrlEventHandler("http://www.reflexive.com/index.php?PAGE=WebGameForMySite&REFERRER=JumpStar&SOURCE=GameOver");
super();
m_reflexiveAPI = ReflexiveAPI.getInstance();
addChild(m_reflexiveAPI);
m_reflexiveAPI.setMedalSchedule("Score", 3000, 40000, 120000, 200000);
introMovie();
}
private function updateDoSaucerGenerator(_arg1:Number):void{
while (m_nextSaucerHeight > -((m_scrollingLayer.y + 300))) {
createSaucer(m_nextSaucerHeight);
m_nextSaucerHeight = (m_nextSaucerHeight - ((Math.random() * (m_maxDistanceBetweenSaucers - m_minDistanceBetweenSaucers)) + m_minDistanceBetweenSaucers));
m_minDistanceBetweenSaucers = (m_minDistanceBetweenSaucers - 35);
m_maxDistanceBetweenSaucers = (m_maxDistanceBetweenSaucers - 35);
if (m_minDistanceBetweenSaucers < 300){
m_minDistanceBetweenSaucers = 300;
};
if (m_maxDistanceBetweenSaucers < 150){
m_maxDistanceBetweenSaucers = 150;
};
};
}
private function introMovie():void{
stage.frameRate = 24;
m_introMovie = new ReflexiveIntroMovie();
addChild(m_introMovie);
m_introMovie.buttonMode = true;
m_introMovie.introMovieButton.addEventListener(MouseEvent.CLICK, m_reflexiveFromIntroMovie.handler);
m_introMovie.gotoAndPlay(0);
m_introMovieTimer = new Timer(4000);
m_introMovieTimer.addEventListener(TimerEvent.TIMER, onIntroMovieDone);
m_introMovieTimer.start();
}
private function updateDoSatelliteGenerator(_arg1:Number):void{
while (m_nextSatelliteHeight > -(((m_scrollingLayer.y + stage.stageHeight) - 500))) {
createSatellite(m_nextSatelliteHeight);
m_nextSatelliteHeight = (m_nextSatelliteHeight - ((Math.random() * (m_maxDistanceBetweenSatellites - m_minDistanceBetweenSatellites)) + m_minDistanceBetweenSatellites));
m_minDistanceBetweenSatellites = (m_minDistanceBetweenSatellites - 25);
m_maxDistanceBetweenSatellites = (m_maxDistanceBetweenSatellites - 35);
if (m_minDistanceBetweenSatellites < 150){
m_minDistanceBetweenSatellites = 150;
};
if (m_maxDistanceBetweenSatellites < 150){
m_maxDistanceBetweenSatellites = 150;
};
};
}
private function createComet(_arg1:Number):void{
var _local2:MovieClip;
if (Math.random() < 0.5){
_local2 = new Comet(this, -40, _arg1, 200);
} else {
_local2 = new Comet(this, 590, _arg1, -20);
};
m_cometsCollectableLayer.addChild(_local2);
}
private function createParticleDefinitions():void{
m_starParticleDefinitions[0] = new Object();
m_starParticleDefinitions[0].count = 15;
m_starParticleDefinitions[0].force = 500;
m_starParticleDefinitions[0].hue = 0;
m_starParticleDefinitions[0].saturation = 1;
m_starParticleDefinitions[0].lightness = 1;
m_starParticleDefinitions[0].ligntnessEnd = 1;
m_starParticleDefinitions[0].lifetime = 0.5;
m_starParticleDefinitions[0].size = 1;
m_starParticleDefinitions[1] = new Object();
m_starParticleDefinitions[1].count = 30;
m_starParticleDefinitions[1].force = 1000;
m_starParticleDefinitions[1].hue = 0.15;
m_starParticleDefinitions[1].saturation = 1;
m_starParticleDefinitions[1].lightness = 0.6;
m_starParticleDefinitions[1].ligntnessEnd = 0.6;
m_starParticleDefinitions[1].lifetime = 0.5;
m_starParticleDefinitions[1].size = 1.5;
m_starParticleDefinitions[2] = new Object();
m_starParticleDefinitions[2].count = 40;
m_starParticleDefinitions[2].force = 1500;
m_starParticleDefinitions[2].hue = 0.6;
m_starParticleDefinitions[2].saturation = 1;
m_starParticleDefinitions[2].lightness = 0.6;
m_starParticleDefinitions[2].ligntnessEnd = 0.6;
m_starParticleDefinitions[2].lifetime = 0.5;
m_starParticleDefinitions[2].size = 3;
m_starParticleDefinitions[3] = new Object();
m_starParticleDefinitions[3].count = 50;
m_starParticleDefinitions[3].force = 2000;
m_starParticleDefinitions[3].hue = 0;
m_starParticleDefinitions[3].saturation = 1;
m_starParticleDefinitions[3].lightness = 0.6;
m_starParticleDefinitions[3].ligntnessEnd = 0.6;
m_starParticleDefinitions[3].lifetime = 0.5;
m_starParticleDefinitions[3].size = 3;
}
public function updateDoSaucers(_arg1:Number):void{
var _local2:int;
var _local3:Saucer;
var _local4:Number;
var _local5:Number;
updateDoSaucerGenerator(_arg1);
_local2 = (m_saucersLayer.numChildren - 1);
while (_local2 >= 0) {
_local3 = (m_saucersLayer.getChildAt(_local2) as Saucer);
_local4 = (_local3.x - m_mainCharacter.x);
_local5 = (_local3.y - m_mainCharacter.y);
if ((((_local3.y > (-(m_scrollingLayer.y) + (stage.stageHeight * 1.25)))) || ((_local3.x > 1000)))){
m_saucersLayer.removeChild(_local3);
} else {
if (((_local3.m_isTractorBeamActive) && (((_local4 * _local4) < (40 * 40))))){
if (m_mainCharacter.y > (_local3.y + 50)){
if (m_mainCharacter.y < (_local3.y + 200)){
m_mainCharacter.InsideTractorBeam();
_local3.HasItemInsideTractorBeam();
};
};
};
};
_local3.update(_arg1);
_local2--;
};
}
private function cleanUpAfterPlay():void{
if (!m_needsCleanUpAfterPlay){
return;
};
removeChild(m_scrollingLayer);
removeChild(m_hud);
m_needsCleanUpAfterPlay = false;
}
public function updateDoComets(_arg1:Number):void{
var _local2:int;
var _local3:Comet;
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:Particle;
updateDoCometGenerator(_arg1);
_local2 = (m_cometsCollectableLayer.numChildren - 1);
while (_local2 >= 0) {
_local3 = (m_cometsCollectableLayer.getChildAt(_local2) as Comet);
_local4 = (_local3.x - m_mainCharacter.x);
_local5 = (_local3.y - m_mainCharacter.y);
if (((_local4 * _local4) + (_local5 * _local5)) <= (64 * 64)){
m_cometsCollectableLayer.removeChild(_local3);
m_hud.AddBooster();
m_mainCharacter.CollectedComet();
_local6 = 0;
while (_local6 < 100) {
_local7 = new Particle(this, _local3.x, _local3.y, (Math.random() * 6.28), 4000, 0.678, 1, 0.8, 0.8, 0.5, 6);
m_particleLayer.addChild(_local7);
_local6++;
};
} else {
_local3.update(_arg1);
};
_local2--;
};
}
public function updateDoSatellites(_arg1:Number):void{
var _local2:int;
var _local3:Satellite;
var _local4:Number;
var _local5:Number;
m_playSatelliteHitSoundTimeout = (m_playSatelliteHitSoundTimeout - _arg1);
updateDoSatelliteGenerator(_arg1);
_local2 = (m_satellitesLayer.numChildren - 1);
while (_local2 >= 0) {
_local3 = (m_satellitesLayer.getChildAt(_local2) as Satellite);
_local4 = (_local3.x - m_mainCharacter.x);
_local5 = (_local3.y - m_mainCharacter.y);
if (((_local4 * _local4) + (_local5 * _local5)) <= (55 * 55)){
m_mainCharacter.BashedSatellite();
if (m_playSatelliteHitSoundTimeout <= 0){
new SatelliteHit().play();
m_playSatelliteHitSoundTimeout = 1;
};
};
_local3.update(_arg1);
_local2--;
};
}
private function updateDoCometGenerator(_arg1:Number):void{
while (m_nextCometHeight > -(((m_scrollingLayer.y + stage.stageHeight) - 100))) {
createComet(m_nextCometHeight);
m_nextCometHeight = (m_nextCometHeight - ((Math.random() * (m_maxDistanceBetweenComets - m_minDistanceBetweenComets)) + m_minDistanceBetweenComets));
m_minDistanceBetweenComets = (m_minDistanceBetweenComets + 1000);
m_maxDistanceBetweenComets = (m_maxDistanceBetweenComets + 1500);
};
}
private function handleUpdate(_arg1:Event):void{
var _local2:Number;
var _local3:SoundTransform;
_local2 = (1 / m_framesPerSecond);
switch (m_state){
case "mainMenu":
break;
case "playing":
m_mainCharacter.update(this, _local2);
updateDoStars(_local2);
updateDoComets(_local2);
updateDoSatellites(_local2);
updateDoSaucers(_local2);
updateDoParticles(_local2);
updateDoScroll(_local2);
m_input.update();
break;
case "gameOver":
m_gameOver.y = (m_gameOver.y - 32);
if (m_gameOver.y < 160){
m_gameOver.y = 160;
};
if (((m_loopingMusicChannel) && ((m_loopingMusicVolume > 0)))){
_local3 = new SoundTransform();
_local3.volume = m_loopingMusicVolume;
m_loopingMusicChannel.soundTransform = _local3;
m_loopingMusicVolume = (m_loopingMusicVolume - 0.025);
};
break;
};
}
public function updateDoScroll(_arg1:Number):void{
var _local2:*;
if (m_mainCharacter.m_altitude < ((stage.stageHeight / 2) - m_groundY)){
m_scrollingLayer.y = 0;
} else {
_local2 = (((stage.stageHeight / 2) - m_scrollingLayer.y) - m_mainCharacter.y);
m_scrollingLayer.y = (m_scrollingLayer.y + _local2);
};
}
private function createSaucer(_arg1:Number):void{
var _local2:MovieClip;
var _local3:Number;
var _local4:Number;
if (Math.random() < 0.3){
_local2 = new Saucer(this, m_mainCharacter.x, _arg1);
m_saucersLayer.addChild(_local2);
} else {
_local3 = ((stage.stageWidth / 6) * 4);
_local4 = (stage.stageWidth / 6);
_local2 = new Saucer(this, ((Math.random() * _local3) + _local4), _arg1);
m_saucersLayer.addChild(_local2);
};
new SpaceshipAppears().play();
}
private function playGame(_arg1:MouseEvent):void{
setState("playing");
}
public function setState(_arg1:String):void{
switch (m_state){
case "undefined":
break;
case "mainMenu":
removeChild(m_mainMenu);
break;
case "playing":
break;
case "gameOver":
removeChild(m_gameOver);
break;
};
m_state = _arg1;
switch (m_state){
case "mainMenu":
m_mainMenu = new MainMenu();
addChild(m_mainMenu);
m_mainMenu.playButton.addEventListener(MouseEvent.CLICK, playGame);
m_mainMenu.moreGamesButton.addEventListener(MouseEvent.CLICK, m_moreGamesFromMainMenu.handler);
m_mainMenu.reflexiveButton.addEventListener(MouseEvent.CLICK, m_reflexiveFromMainMenu.handler);
m_mainMenu.onYourSiteButton.addEventListener(MouseEvent.CLICK, m_onYourSiteFromMainMenu.handler);
m_mainMenu.getFreeGamesButton.addEventListener(MouseEvent.CLICK, m_getFreeGamesFromMainMenu.handler);
break;
case "playing":
initializeForPlay();
m_hud.getFreeGamesButton.addEventListener(MouseEvent.CLICK, m_getFreeGamesFromHud.handler);
break;
case "gameOver":
m_gameOver = new GameOver();
m_gameOver.y = 700;
addChild(m_gameOver);
m_gameOver.playButton.addEventListener(MouseEvent.CLICK, playGame);
m_gameOver.moreGamesButton.addEventListener(MouseEvent.CLICK, m_moreGamesFromGameOver.handler);
m_gameOver.onYourSiteButton.addEventListener(MouseEvent.CLICK, m_onYourSiteFromGameOver.handler);
break;
};
}
private function createStar(_arg1:Number, _arg2:Number, _arg3:int):void{
var _local4:MovieClip;
_local4 = new Star(this, _arg1, _arg2, (_arg3 - 1));
_local4.gotoAndStop(_arg3);
m_starsCollectableLayer.addChild(_local4);
}
public function updateDoStars(_arg1:Number):void{
var _local2:int;
var _local3:Star;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:Sound;
var _local8:SoundChannel;
var _local9:SoundTransform;
var _local10:int;
var _local11:*;
updateDoStarGenerator(_arg1);
_local2 = (m_starsCollectableLayer.numChildren - 1);
while (_local2 >= 0) {
_local3 = (m_starsCollectableLayer.getChildAt(_local2) as Star);
if (_local3.y > ((-(m_scrollingLayer.y) + stage.stageHeight) + m_removeStarsBelowDistance)){
m_starsCollectableLayer.removeChild(_local3);
} else {
_local4 = (_local3.x - m_mainCharacter.x);
_local5 = (_local3.y - m_mainCharacter.y);
if (((_local4 * _local4) + (_local5 * _local5)) <= (48 * 48)){
m_starsCollectableLayer.removeChild(_local3);
m_mainCharacter.CollectedInstantThrust();
m_hud.AccumulateScore(this, m_scorePerStar);
m_scorePerStar = (m_scorePerStar + (m_scoreBonusPerStar * _local3.currentFrame));
_local6 = _local3.m_type;
switch (_local3.m_type){
case 0:
_local7 = new GetStar1();
break;
case 1:
_local7 = new GetStar2();
break;
case 2:
_local7 = new GetStar3();
break;
case 3:
_local7 = new GetStar4();
break;
};
_local8 = _local7.play();
_local9 = new SoundTransform();
_local9.pan = (((_local3.x / stage.stageWidth) * 2) - 1);
_local8.soundTransform = _local9;
_local10 = 0;
while (_local10 < m_starParticleDefinitions[_local6].count) {
_local11 = new Particle(this, _local3.x, _local3.y, (Math.random() * 6.28), m_starParticleDefinitions[_local6].force, m_starParticleDefinitions[_local6].hue, m_starParticleDefinitions[_local6].saturation, m_starParticleDefinitions[_local6].lightness, m_starParticleDefinitions[_local6].ligntnessEnd, m_starParticleDefinitions[_local6].lifetime, m_starParticleDefinitions[_local6].size);
m_particleLayer.addChild(_local11);
_local10++;
};
};
};
_local2--;
};
}
private function createSatellite(_arg1:Number):void{
var _local2:MovieClip;
if (Math.random() < 0.5){
_local2 = new Satellite(this, -80, _arg1, ((180 + (Math.random() * 25)) - 0));
} else {
_local2 = new Satellite(this, 630, _arg1, ((0 - (Math.random() * 25)) - 0));
};
m_satellitesLayer.addChild(_local2);
new SatelliteAppears().play();
}
private function createStarDistributions():void{
m_starDistributionArrayArray = new Array(new Array(100, 0, 0, 0, 0, 0, 0, 0), new Array(100, 0, 0, 0, 50, 0, 0, 0), new Array(100, 0, 0, 0, 20, 0, 0, 0), new Array(100, 0, 0, 0, 0, 0, 0, 0), new Array(80, 20, 0, 0, 30, 0, 0, 0), new Array(60, 40, 0, 0, 30, 0, 0, 0), new Array(40, 60, 0, 0, 70, 0, 0, 0), new Array(20, 80, 0, 0, 80, 80, 0, 0), new Array(20, 80, 0, 0, 20, 10, 0, 0), new Array(20, 80, 0, 0, 10, 20, 0, 0), new Array(20, 80, 0, 0, 10, 20, 10, 0), new Array(20, 80, 0, 0, 40, 40, 80, 0), new Array(10, 90, 0, 0, 0, 30, 20, 0), new Array(10, 90, 0, 0, 0, 30, 30, 0), new Array(10, 80, 10, 0, 0, 80, 50, 0), new Array(10, 70, 20, 0, 0, 0, 20, 0), new Array(10, 65, 25, 0, 0, 0, 50, 0), new Array(10, 60, 30, 0, 60, 80, 80, 0), new Array(10, 55, 35, 0, 0, 0, 10, 0), new Array(10, 50, 40, 0, 0, 60, 20, 0), new Array(5, 50, 45, 0, 0, 0, 10, 10), new Array(5, 45, 50, 0, 0, 0, 10, 20), new Array(5, 35, 60, 0, 80, 80, 80, 30), new Array(5, 25, 70, 0, 0, 0, 10, 30), new Array(5, 15, 80, 0, 0, 0, 0, 10), new Array(5, 5, 90, 0, 0, 0, 20, 20), new Array(5, 5, 90, 0, 5, 0, 0, 10), new Array(5, 5, 80, 10, 5, 5, 0, 20), new Array(5, 5, 70, 20, 50, 50, 50, 70), new Array(5, 5, 60, 30, 0, 5, 0, 0), new Array(5, 5, 50, 40, 0, 0, 5, 0), new Array(5, 5, 40, 50, 0, 0, 5, 0), new Array(5, 5, 30, 60, 0, 0, 5, 0), new Array(5, 5, 20, 70, 80, 70, 90, 70), new Array(5, 5, 10, 80, 5, 0, 0, 0), new Array(5, 5, 5, 85, 0, 0, 5, 5), new Array(5, 5, 5, 85, 0, 0, 0, 5), new Array(5, 5, 5, 85, 50, 50, 50, 50), new Array(10, 10, 10, 70, 0, 0, 0, 0), new Array(10, 10, 20, 60, 0, 0, 0, 5), new Array(10, 20, 20, 50, 0, 0, 5, 0), new Array(20, 20, 20, 40, 0, 90, 90, 90), new Array(20, 25, 25, 30, 0, 0, 0, 20), new Array(25, 25, 25, 25, 0, 10, 0, 10), new Array(25, 25, 25, 25, 0, 0, 0, 10), new Array(25, 25, 25, 25, 0, 0, 0, 0), new Array(25, 25, 25, 25, 0, 0, 0, 0), new Array(0, 0, 0, 0));
}
private function onIntroMovieDone(_arg1:Event):void{
m_introMovieTimer.stop();
removeChild(m_introMovie);
createStarDistributions();
createParticleDefinitions();
setState("mainMenu");
addEventListener(Event.ENTER_FRAME, handleUpdate, false, 0, true);
}
private function updateDoStarGenerator(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:Array;
var _local8:Number;
var _local9:int;
var _local10:int;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local2 = ((stage.stageWidth / 6) * 4);
_local3 = (stage.stageWidth / 6);
_local4 = (_local3 + _local2);
_local5 = ((Math.random() * _local2) + _local3);
while (m_nextStarHeight > -(((m_scrollingLayer.y + stage.stageHeight) + 100))) {
_local6 = Math.min(Math.floor(((-((m_nextStarHeight - stage.stageHeight)) / m_maxGameHeight) * m_starDistributionArrayArray.length)), (m_starDistributionArrayArray.length - 1));
_local7 = m_starDistributionArrayArray[_local6];
_local8 = 0;
_local9 = 0;
while (_local9 < 4) {
_local8 = (_local8 + _local7[_local9]);
_local9++;
};
_local10 = 0;
_local11 = (Math.random() * _local8);
_local12 = 0;
_local9 = 0;
while (_local9 < 4) {
_local13 = (_local12 + _local7[_local9]);
if ((((_local11 > _local12)) && ((_local11 <= _local13)))){
_local10 = (_local9 + 1);
break;
};
_local12 = _local13;
_local9++;
};
if (_local10 != 0){
createStar(_local5, m_nextStarHeight, _local10);
};
_local9 = 4;
while (_local9 < 8) {
if ((Math.random() * 100) <= _local7[_local9]){
createStar(((Math.random() * _local2) + _local3), (m_nextStarHeight + (Math.random() * m_maxDistanceBetweenStars)), (_local9 - 3));
};
_local9++;
};
_local5 = (_local5 + (((Math.random() * 2) - 1) * (stage.stageWidth / 4)));
if (_local5 > _local4){
_local5 = (_local5 - _local2);
} else {
if (_local5 < _local3){
_local5 = (_local5 + _local2);
};
};
m_nextStarHeight = (m_nextStarHeight - ((Math.random() * (m_maxDistanceBetweenStars - m_minDistanceBetweenStars)) + m_minDistanceBetweenStars));
m_minDistanceBetweenStars = (m_minDistanceBetweenStars + 0.9);
m_maxDistanceBetweenStars = (m_maxDistanceBetweenStars + 1.4);
};
}
public function updateDoParticles(_arg1:Number):void{
var _local2:int;
var _local3:Particle;
_local2 = (m_particleLayer.numChildren - 1);
while (_local2 >= 0) {
_local3 = (m_particleLayer.getChildAt(_local2) as Particle);
_local3.update(_arg1);
if (_local3.m_remainingLifeTime <= 0){
m_particleLayer.removeChild(_local3);
};
_local2--;
};
}
private function initializeForPlay():void{
stage.frameRate = m_framesPerSecond;
cleanUpAfterPlay();
if (m_loopingMusicChannel){
m_loopingMusicChannel.stop();
};
m_input = new Input(this);
m_scrollingLayer = new ScrollingGameBackground(this);
addChild(m_scrollingLayer);
m_particleLayer = new Sprite();
m_scrollingLayer.addChild(m_particleLayer);
m_starsCollectableLayer = new Sprite();
m_scrollingLayer.addChild(m_starsCollectableLayer);
m_satellitesLayer = new Sprite();
m_scrollingLayer.addChild(m_satellitesLayer);
m_cometsCollectableLayer = new Sprite();
m_scrollingLayer.addChild(m_cometsCollectableLayer);
m_saucersLayer = new Sprite();
m_scrollingLayer.addChild(m_saucersLayer);
m_mainCharacter = new MainCharacter();
m_scrollingLayer.addChild(m_mainCharacter);
m_hud = new GameHud();
addChild(m_hud);
m_minDistanceBetweenStars = m_minDistanceBetweenStarsInitial;
m_maxDistanceBetweenStars = m_maxDistanceBetweenStarsInitial;
m_nextStarHeight = (stage.stageHeight * 0.55);
m_scorePerStar = m_scoreBasePerStar;
m_minDistanceBetweenComets = m_minDistanceBetweenCometsInitial;
m_maxDistanceBetweenComets = m_maxDistanceBetweenCometsInitial;
m_nextCometHeight = -3300;
m_minDistanceBetweenSatellites = m_minDistanceBetweenSatellitesInitial;
m_maxDistanceBetweenSatellites = m_maxDistanceBetweenSatellitesInitial;
m_nextSatelliteHeight = -6000;
m_minDistanceBetweenSaucers = m_minDistanceBetweenSaucersInitial;
m_maxDistanceBetweenSaucers = m_maxDistanceBetweenSaucersInitial;
m_nextSaucerHeight = -1000;
m_loopingMusic = new LoopingMusic();
m_loopingMusicChannel = m_loopingMusic.play(0, 999);
m_loopingMusicVolume = 1;
m_needsCleanUpAfterPlay = true;
}
}
}//package
Section 36
//SpaceshipAppears (SpaceshipAppears)
package {
import flash.media.*;
public dynamic class SpaceshipAppears extends Sound {
}
}//package
Section 37
//Star (Star)
package {
import flash.display.*;
public class Star extends MovieClip {
public var m_positionY:Number;
public var m_secondsAlive:Number;// = 0
public var m_rand1:Number;
public var m_gameController:SpaceBoy;
public var m_type:int;
public var m_positionX:Number;
public function Star(_arg1:SpaceBoy, _arg2:Number, _arg3:Number, _arg4:int){
m_secondsAlive = 0;
super();
m_gameController = _arg1;
x = (m_positionX = _arg2);
y = (m_positionY = _arg3);
m_type = _arg4;
m_rand1 = Math.random();
}
public function update(_arg1:Number):void{
m_secondsAlive = (m_secondsAlive + _arg1);
switch (m_type){
case 0:
x = (m_positionX + (Math.cos(((m_secondsAlive * m_rand1) * 2)) * 8));
y = (m_positionY + (Math.sin(((m_secondsAlive * m_rand1) * 2)) * 8));
break;
case 1:
rotation = (rotation + ((_arg1 * 100) * ((m_rand1 * 2) - 1)));
break;
case 2:
rotation = (rotation + (_arg1 * 300));
break;
case 3:
rotation = (rotation + (_arg1 * -180));
break;
};
}
}
}//package
Section 38
//StarCluster (StarCluster)
package {
import flash.display.*;
public dynamic class StarCluster extends MovieClip {
}
}//package
Section 39
//starCluster01 (starCluster01)
package {
import flash.display.*;
public dynamic class starCluster01 extends MovieClip {
}
}//package
Section 40
//StarThrust (StarThrust)
package {
import flash.media.*;
public dynamic class StarThrust extends Sound {
}
}//package
Section 41
//TractorBeam (TractorBeam)
package {
import flash.display.*;
public dynamic class TractorBeam extends MovieClip {
}
}//package