Section 1
//MainTimeline (benrunrunnow_secure_fla.MainTimeline)
package benrunrunnow_secure_fla {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class MainTimeline extends MovieClip {
public var logo:SimpleButton;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function buttonClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://gamerightnow.com"), "_blank");
trace("OK");
}
function frame1(){
logo.addEventListener(MouseEvent.CLICK, buttonClickHandler);
}
}
}//package benrunrunnow_secure_fla
Section 2
//MC_CAVE_RUN_1 (benrunrunnow_secure_fla.MC_CAVE_RUN_1)
package benrunrunnow_secure_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MC_CAVE_RUN_1 extends MovieClip {
public var bglvl2_mc:MC_backgroundLvl2;
public var coin_mc:MC_coin;
public var _playerHitFireJump:int;
public var _playerHitIce:Boolean;
public var _highPlatform:Number;
public var _platformIndex:int;
public var _playerSpeed:Number;
public var _lowPlatform:Number;
public var _playerRunFastFrame:int;
public var _playerHitFire:Boolean;
public var _debrisIndex:int;
public var _stepSoundLeft:Boolean;
public var _playerJump:int;
public var _stepSoundRight:Boolean;
public var _timer:Timer;
public var _frame:Number;
public var _playerState:int;
public var _quakeSnd:SND_quake;
public var _playerAcceleration:Number;
public var _fallSnd:SND_fall;
public var coins_txt:TextField;
public var _obstacleChance:Number;
public var _coinChance:Number;
public var _coinArray:Array;
public var _indexA:int;
public var _indexB:int;
public var _nextLevel:int;
public var _stageInitPosX:int;
public var _stageInitPosY:int;
public var _hitIceSnd:SND_hitIce;
public var _longPlatform:int;
public var _shortPlatform:int;
public var _jumpSnd:SND_jump;
public var distance_txt:TextField;
public var _debrisdelay:int;
public var _lvlUpSnd:SND_LVLUP;
public var _coinIndex:int;
public var _totalScore:int;
public var _dustArray:Array;
public var _playerJumpPower:int;
public var _distance:int;
public var _bannerChance:Number;
public var _playerMaxSpeed:int;
public var _currentLevel:int;
public var _playerHit:Boolean;
public var mute_mc:MovieClip;
public var _coinCount:int;
public var _playerInitialSpeed:int;
public var _hurtSnd:SND_hurt;
public var bglvl1_mc:MC_backgroundLvl1;
public var _platformArray:Array;
public var stageArea_mc:MovieClip;
public var _platformGap:int;
public var player_mc:MovieClip;
public var _stepWetSnd:SND_stepWet;
public var _crashSnd:SND_crash;
public var _dustIndex:int;
public var _playerRunFrame:int;
public var _stepSnd:SND_step;
public var bg_mc:MovieClip;
public var _coinSnd:SND_coin;
public var _debrisArray:Array;
public var _quake:Number;
public var _hitFireSnd:SND_hitFire;
public var _bannerDelay:int;
public function MC_CAVE_RUN_1(){
addFrameScript(0, frame1);
}
public function mute(_arg1:MouseEvent):void{
mute_mc.removeEventListener(MouseEvent.MOUSE_UP, mute);
mute_mc.addEventListener(MouseEvent.MOUSE_UP, unmute);
mute_mc.gotoAndStop(2);
SoundMixer.soundTransform = new SoundTransform(0);
}
public function unmute(_arg1:MouseEvent):void{
mute_mc.removeEventListener(MouseEvent.MOUSE_UP, unmute);
mute_mc.addEventListener(MouseEvent.MOUSE_UP, mute);
mute_mc.gotoAndStop(1);
SoundMixer.soundTransform = new SoundTransform(1);
}
public function BGcolor(_arg1:Number, _arg2:Number, _arg3:Number){
var _local4:ColorTransform;
var _local5:ColorTransform;
var _local6:ColorTransform;
_local4 = bg_mc.transform.colorTransform;
_local4.redMultiplier = _arg1;
_local4.greenMultiplier = _arg2;
_local4.blueMultiplier = _arg3;
bg_mc.transform.colorTransform = _local4;
_local5 = bglvl1_mc.transform.colorTransform;
_local5.redMultiplier = _arg1;
_local5.greenMultiplier = _arg2;
_local5.blueMultiplier = _arg3;
bglvl1_mc.transform.colorTransform = _local5;
_local6 = bglvl2_mc.transform.colorTransform;
_local6.redMultiplier = _arg1;
_local6.greenMultiplier = _arg2;
_local6.blueMultiplier = _arg3;
bglvl2_mc.transform.colorTransform = _local6;
}
public function levelUpEffectFade(_arg1:Event):void{
addChild(MovieClip(_arg1.target));
if (_arg1.target.flash_mc.alpha > 0){
_arg1.target.flash_mc.alpha = (_arg1.target.flash_mc.alpha - 0.05);
} else {
if (_arg1.target.alpha > 0){
_arg1.target.alpha = (_arg1.target.alpha - 0.01);
} else {
_arg1.target.removeEventListener(Event.ENTER_FRAME, levelUpEffectFade);
removeChild(MovieClip(_arg1.target));
};
};
}
function frame1(){
_stageInitPosX = this.x;
_stageInitPosY = this.y;
_playerInitialSpeed = 5;
_playerSpeed = _playerInitialSpeed;
_playerMaxSpeed = 50;
_playerAcceleration = 0.05;
_playerJump = 0;
_playerJumpPower = 25;
_playerState = 0;
_playerRunFrame = 31;
_playerRunFastFrame = 190;
_playerHit = false;
_playerHitFire = false;
_playerHitFireJump = 0;
_playerHitIce = false;
_distance = 0;
_coinCount = 0;
_coinChance = 0.5;
_coinArray = new Array();
_coinIndex = 0;
_currentLevel = 1;
_nextLevel = 10;
_totalScore = 0;
_platformArray = new Array();
_platformGap = 200;
_platformIndex = 0;
_highPlatform = (0.9 * stageArea_mc.height);
_lowPlatform = (0.1 * stageArea_mc.height);
_shortPlatform = 5;
_longPlatform = 10;
_quake = 0;
_indexA = 0;
_indexB = 0;
_debrisArray = new Array();
_debrisIndex = 0;
_debrisdelay = 0;
_dustArray = new Array();
_dustIndex = 0;
_obstacleChance = 0.5;
_bannerChance = 0.5;
_bannerDelay = 100;
_timer = new Timer(1000);
_frame = 0;
_stepSoundLeft = false;
_stepSoundRight = false;
_stepSnd = new SND_step();
_stepWetSnd = new SND_stepWet();
_quakeSnd = new SND_quake();
_jumpSnd = new SND_jump();
_coinSnd = new SND_coin();
_crashSnd = new SND_crash();
_fallSnd = new SND_fall();
_hurtSnd = new SND_hurt();
_hitFireSnd = new SND_hitFire();
_hitIceSnd = new SND_hitIce();
_lvlUpSnd = new SND_LVLUP();
mute_mc.buttonMode = true;
mute_mc.addEventListener(MouseEvent.MOUSE_UP, mute);
mute_mc.gotoAndStop(1);
initialization();
_timer.addEventListener(TimerEvent.TIMER, timer);
_timer.start();
addEventListener(Event.ENTER_FRAME, frameRate);
}
public function readyGoAnim(_arg1:Event):void{
this.addChild(MovieClip(_arg1.target));
if (_arg1.target.currentFrame == 30){
gameStart();
player_mc.idle_mc.visible = false;
player_mc.run_mc.visible = true;
player_mc.run_mc.gotoAndPlay(_playerRunFrame);
_quake = 15;
_quakeSnd.play();
};
if (_arg1.target.currentFrame == _arg1.target.totalFrames){
_arg1.target.removeEventListener(Event.ENTER_FRAME, readyGoAnim);
this.removeChild(MovieClip(_arg1.target));
};
}
public function initialization(){
var _local1:MC_clickToStart;
stageArea_mc.visible = false;
player_mc.hitArea_mc.visible = false;
player_mc.idle_mc.visible = true;
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = false;
player_mc.hit_mc.visible = false;
player_mc.hitFire_mc.visible = false;
player_mc.hitIce_mc.visible = false;
distance_txt.selectable = false;
_playerState = 0;
_playerJump = 0;
_distance = 0;
_coinCount = 0;
coin_mc.visible = true;
coin_mc.coinShadow_mc.visible = false;
coins_txt.text = _coinCount.toString();
coins_txt.selectable = false;
checkLevel();
distance_txt.text = _distance.toString();
_playerSpeed = _playerInitialSpeed;
player_mc.x = ((stageArea_mc.width * 0.1) + (_playerSpeed * 3));
createPlatform((player_mc.x - (player_mc.width / 2)), (_lowPlatform + (Math.random() * (_highPlatform - _lowPlatform))), (_shortPlatform + int(((Math.random() * (_longPlatform - _shortPlatform)) + 0.5))));
player_mc.y = _platformArray[(_platformArray.length - 1)].y;
_indexB = 0;
while (_indexB < _platformArray[(_platformArray.length - 1)].numChildren) {
_platformArray[(_platformArray.length - 1)].getChildAt(_indexB).visible = true;
_indexB++;
};
addChild(player_mc);
_local1 = new MC_clickToStart();
addChild(_local1);
_local1.x = (stageArea_mc.width * 0.5);
_local1.y = (stageArea_mc.height * 0.5);
_local1.name = "clickToStart_mc";
stage.addEventListener(MouseEvent.MOUSE_UP, clickToStart);
}
public function retry(_arg1:MouseEvent):void{
var _readyGo:MC_readyGo;
var event = _arg1;
try {
event.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, retry);
removeChild(MovieClip(event.currentTarget));
_platformIndex = 0;
while (_platformIndex < _platformArray.length) {
removeChild(_platformArray[_platformIndex]);
_platformIndex++;
};
_platformArray = [];
initialization();
_readyGo = new MC_readyGo();
addChild(_readyGo);
_readyGo.x = (stageArea_mc.width * 0.5);
_readyGo.y = (stageArea_mc.height * 0.5);
_readyGo.cacheAsBitmap = true;
_readyGo.name = "readyGo_mc";
_readyGo.addEventListener(Event.ENTER_FRAME, readyGoAnim);
} catch(err:Error) {
trace("catch error 1009 on retry");
};
}
public function controlStop(){
stage.removeEventListener(MouseEvent.MOUSE_DOWN, startJump);
stage.addEventListener(MouseEvent.MOUSE_UP, stopJump);
}
public function gameStop(){
stage.removeEventListener(Event.ENTER_FRAME, gameAnimation);
controlStop();
}
public function controlStart(){
stage.addEventListener(MouseEvent.MOUSE_DOWN, startJump);
stage.addEventListener(MouseEvent.MOUSE_UP, stopJump);
}
public function timer(_arg1:TimerEvent){
if (_frame < 23){
stage.quality = "low";
};
if (_frame > 31){
stage.quality = "medium";
};
_frame = 0;
}
public function stopJump(_arg1:MouseEvent):void{
if ((((((_playerState == 1)) && (!(_playerHit)))) && (!(_playerHitFire)))){
_playerJump = (_playerJump * 0.25);
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = true;
player_mc.fall_mc.gotoAndPlay(1);
};
}
public function checkLevel(){
if (_coinCount == 0){
_currentLevel = 1;
_nextLevel = 20;
_playerMaxSpeed = 10;
_highPlatform = (0.3 * stageArea_mc.height);
_lowPlatform = (0.2 * stageArea_mc.height);
_shortPlatform = 12;
_longPlatform = 16;
_platformGap = 50;
_obstacleChance = 0;
_bannerChance = 0.01;
_coinChance = 0.5;
} else {
if (_coinCount == 20){
_currentLevel = 2;
_nextLevel = 50;
_playerMaxSpeed = 15;
_highPlatform = (0.4 * stageArea_mc.height);
_lowPlatform = (0.2 * stageArea_mc.height);
_shortPlatform = 11;
_longPlatform = 15;
_platformGap = 100;
_obstacleChance = 0.02;
_bannerChance = 0.01;
_coinChance = 0.55;
} else {
if (_coinCount == 50){
_currentLevel = 3;
_nextLevel = 100;
_playerMaxSpeed = 20;
_highPlatform = (0.5 * stageArea_mc.height);
_lowPlatform = (0.2 * stageArea_mc.height);
_shortPlatform = 10;
_longPlatform = 14;
_platformGap = 150;
_obstacleChance = 0.04;
_bannerChance = 0.01;
_coinChance = 0.6;
} else {
if (_coinCount == 100){
_currentLevel = 4;
_nextLevel = 200;
_playerMaxSpeed = 25;
_highPlatform = (0.8 * stageArea_mc.height);
_lowPlatform = (0.3 * stageArea_mc.height);
_shortPlatform = 9;
_longPlatform = 12;
_platformGap = 200;
_obstacleChance = 0.06;
_bannerChance = 0.01;
_coinChance = 0.65;
} else {
if (_coinCount == 200){
_currentLevel = 5;
_nextLevel = 300;
_playerMaxSpeed = 30;
_highPlatform = (0.7 * stageArea_mc.height);
_lowPlatform = (0.2 * stageArea_mc.height);
_shortPlatform = 8;
_longPlatform = 10;
_platformGap = 300;
_obstacleChance = 0.08;
_bannerChance = 0.01;
_coinChance = 0.7;
} else {
if (_coinCount == 300){
_currentLevel = 6;
_nextLevel = 400;
_playerMaxSpeed = 35;
_highPlatform = (0.7 * stageArea_mc.height);
_lowPlatform = (0.1 * stageArea_mc.height);
_shortPlatform = 7;
_longPlatform = 9;
_platformGap = 400;
_obstacleChance = 0.1;
_bannerChance = 0.01;
_coinChance = 0.75;
} else {
if (_coinCount == 400){
_currentLevel = 7;
_nextLevel = 500;
_playerMaxSpeed = 40;
_highPlatform = (0.8 * stageArea_mc.height);
_lowPlatform = (0.1 * stageArea_mc.height);
_shortPlatform = 6;
_longPlatform = 8;
_platformGap = 500;
_obstacleChance = 0.12;
_bannerChance = 0.01;
_coinChance = 0.8;
} else {
if (_coinCount == 500){
_currentLevel = 8;
_nextLevel = 600;
_playerMaxSpeed = 45;
_highPlatform = (0.9 * stageArea_mc.height);
_lowPlatform = (0.1 * stageArea_mc.height);
_shortPlatform = 5;
_longPlatform = 7;
_platformGap = 600;
_obstacleChance = 0.14;
_bannerChance = 0.01;
_coinChance = 0.85;
} else {
if (_coinCount == 600){
_currentLevel = 9;
_nextLevel = 700;
_playerMaxSpeed = 50;
_highPlatform = (0.9 * stageArea_mc.height);
_lowPlatform = (0.1 * stageArea_mc.height);
_shortPlatform = 4;
_longPlatform = 6;
_platformGap = 700;
_obstacleChance = 0.16;
_bannerChance = 0.01;
_coinChance = 0.9;
} else {
if ((_coinCount % 100) == 0){
_currentLevel++;
_nextLevel = (_nextLevel + 100);
_playerMaxSpeed = (_playerMaxSpeed + 5);
_highPlatform = (0.9 * stageArea_mc.height);
_lowPlatform = (0.1 * stageArea_mc.height);
_shortPlatform = 3;
_longPlatform = 5;
_platformGap = 800;
_obstacleChance = (_obstacleChance + 0.02);
_bannerChance = 0.01;
_coinChance = 0.95;
};
};
};
};
};
};
};
};
};
};
if (_coinCount > 0){
_quake = 15;
_quakeSnd.play();
_lvlUpSnd.play();
levelUpEffect();
};
BGcolor((Math.random() + 0.5), (Math.random() + 0.5), (Math.random() + 0.5));
}
public function gameStart(){
stage.addEventListener(Event.ENTER_FRAME, gameAnimation);
controlStart();
}
public function crashAnimation(_arg1:Event):void{
var _local2:MC_retry;
if (_quake > 0){
_quake--;
this.y = ((Math.random() * _quake) - (_quake * 0.5));
} else {
this.y = _stageInitPosY;
removeEventListener(Event.ENTER_FRAME, crashAnimation);
_local2 = new MC_retry();
addChild(_local2);
_local2.x = (stageArea_mc.width * 0.5);
_local2.y = (stageArea_mc.height * 0.5);
_local2.distance_txt.text = Math.round((_distance * 0.1)).toString();
_local2.coins_txt.text = (_coinCount.toString() + " x 10");
_local2.level_txt.text = (1 + (0.2 * (_currentLevel - 1))).toString();
_totalScore = Math.ceil(((1 + (0.2 * (_currentLevel - 1))) * ((_distance * 0.1) + (_coinCount * 10))));
_local2.score_txt.text = _totalScore.toString();
_local2.distance_txt.selectable = false;
_local2.coins_txt.selectable = false;
_local2.level_txt.selectable = false;
_local2.score_txt.selectable = false;
distance_txt.text = "";
coins_txt.text = "";
coin_mc.visible = false;
_local2.buttonMode = true;
_local2.addEventListener(MouseEvent.MOUSE_UP, retry);
};
}
public function createPlatform(_arg1:int=0, _arg2:int=0, _arg3:int=10):void{
var _local4:MovieClip;
var _local5:MC_decal;
var _local6:MC_banner;
var _local7:MC_obstacle;
var _local8:MC_coin;
_local4 = new MovieClip();
_local4.x = _arg1;
_local4.y = (stageArea_mc.height - _arg2);
_local4.graphics.beginFill(0x888888);
_local4.graphics.drawRect(0, -10, (_arg3 * 100), stageArea_mc.height);
_local4.graphics.endFill();
addChild(_local4);
_local4._state = 0;
_platformArray.push(_local4);
_indexA = 0;
while (_indexA < _arg3) {
_local5 = new MC_decal();
_platformArray[(_platformArray.length - 1)].addChild(_local5);
if (_indexA == 0){
_local5.gotoAndStop(1);
} else {
_local5.gotoAndStop((Math.ceil((Math.random() * (_local5.totalFrames - 2))) + 1));
};
_local5.x = (_indexA * _local5.width);
_local5.cacheAsBitmap = true;
_local5.visible = false;
_indexA++;
};
_local5.gotoAndStop(_local5.totalFrames);
_local5.visible = true;
_local5.cacheAsBitmap = true;
_indexB = _platformArray[(_platformArray.length - 1)].numChildren;
_indexA = 0;
while (_indexA < _indexB) {
if ((((Math.random() < _bannerChance)) && ((_bannerDelay == 0)))){
_local6 = new MC_banner();
_platformArray[(_platformArray.length - 1)].addChild(_local6);
_local6.x = (_platformArray[(_platformArray.length - 1)].getChildAt(_indexA).x + (_platformArray[(_platformArray.length - 1)].getChildAt(_indexA).width * 0.5));
_local6.gotoAndStop(Math.ceil((Math.random() * _local6.totalFrames)));
_local6.rotation = (int(((Math.random() * 4) + 0.5)) - 2);
_local6.cacheAsBitmap = true;
_bannerDelay = 100;
} else {
if (Math.random() < _obstacleChance){
_local7 = new MC_obstacle();
_platformArray[(_platformArray.length - 1)].addChild(_local7);
_local7.x = (_platformArray[(_platformArray.length - 1)].getChildAt(_indexA).x + (_platformArray[(_platformArray.length - 1)].getChildAt(_indexA).width * 0.5));
_local7.gotoAndStop(Math.ceil((Math.random() * _local7.totalFrames)));
_local7._state = 0;
} else {
if (Math.random() < _coinChance){
_local8 = new MC_coin();
_platformArray[(_platformArray.length - 1)].addChild(_local8);
_local8.x = (_platformArray[(_platformArray.length - 1)].getChildAt(_indexA).x + (_platformArray[(_platformArray.length - 1)].getChildAt(_indexA).width * 0.5));
_coinArray.push(_local8);
};
};
};
_indexA++;
};
}
public function startJump(_arg1:MouseEvent):void{
if ((((((_playerState == 0)) && (!(_playerHit)))) && (!(_playerHitFire)))){
_playerHitIce = false;
_playerJump = _playerJumpPower;
_playerState = 1;
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.jump_mc.visible = true;
player_mc.hitIce_mc.visible = false;
player_mc.jump_mc.gotoAndPlay(1);
_jumpSnd.play();
};
}
public function levelUpEffect(){
var _local1:MC_levelUpEffect;
_local1 = new MC_levelUpEffect();
addChild(_local1);
_local1.x = (stageArea_mc.width * 0.5);
_local1.y = (stageArea_mc.height * 0.5);
_local1.flash_mc.width = stageArea_mc.width;
_local1.flash_mc.height = stageArea_mc.height;
_local1.addEventListener(Event.ENTER_FRAME, levelUpEffectFade);
}
public function gameAnimation(_arg1:Event):void{
var _local2:MC_debris;
var _local3:MC_debris;
bglvl1_mc.x = (bglvl1_mc.x - (_playerSpeed * 0.25));
if (bglvl1_mc.x < -(stageArea_mc.width)){
bglvl1_mc.x = 0;
};
bglvl2_mc.x = (bglvl2_mc.x - (_playerSpeed * 0.125));
if (bglvl2_mc.x < -(stageArea_mc.width)){
bglvl2_mc.x = 0;
};
if (player_mc.run_mc.visible){
if ((player_mc.run_mc.totalFrames - (player_mc.run_mc.currentFrame + Math.ceil((_playerSpeed * 0.1)))) > 0){
_playerRunFrame = (_playerRunFrame + Math.ceil((_playerSpeed * 0.1)));
} else {
_playerRunFrame = 1;
_stepSoundLeft = false;
_stepSoundRight = false;
};
player_mc.run_mc.gotoAndStop(_playerRunFrame);
if ((((_stepSoundLeft == false)) && ((player_mc.run_mc.currentFrame > 5)))){
_stepSnd.play();
_stepSoundLeft = true;
};
if ((((_stepSoundRight == false)) && ((player_mc.run_mc.currentFrame > 25)))){
_stepSnd.play();
_stepSoundRight = true;
};
};
if (player_mc.runFast_mc.visible){
if ((player_mc.runFast_mc.totalFrames - (player_mc.runFast_mc.currentFrame + Math.ceil((_playerSpeed * 0.5)))) > 0){
_playerRunFastFrame = (_playerRunFastFrame + Math.ceil((_playerSpeed * 0.5)));
if (Math.random() > 0.8){
createDust(player_mc.x, (player_mc.y - (Math.random() * 10)), ((Math.random() * 0.5) + 0.3), (-(_playerSpeed) * 0.5), ((-(Math.random()) * 0.5) + 0.3), ((Math.random() * 20) - 10));
};
} else {
_playerRunFastFrame = 1;
_stepSoundLeft = false;
_stepSoundRight = false;
};
if ((((_stepSoundLeft == false)) && ((player_mc.runFast_mc.currentFrame > 60)))){
_stepSnd.play();
_stepSoundLeft = true;
};
if ((((_stepSoundRight == false)) && ((player_mc.runFast_mc.currentFrame > 180)))){
_stepSnd.play();
_stepSoundRight = true;
};
};
player_mc.runFast_mc.gotoAndStop(_playerRunFastFrame);
if (((player_mc.fall_mc.visible) && ((player_mc.fall_mc.currentFrame == player_mc.fall_mc.totalFrames)))){
_fallSnd.play();
};
if (_playerState == 0){
if (_playerSpeed < 20){
player_mc.run_mc.visible = true;
player_mc.runFast_mc.visible = false;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = false;
} else {
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = true;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = false;
};
};
if (_playerSpeed < _playerMaxSpeed){
_playerSpeed = (_playerSpeed + _playerAcceleration);
};
_distance = (_distance + _playerSpeed);
distance_txt.text = Math.round((_distance * 0.1)).toString();
player_mc.x = ((stageArea_mc.width * 0.1) + (_playerSpeed * 3));
if ((((_playerState == 1)) && ((_playerJump > 0)))){
player_mc.y = (player_mc.y - _playerJump);
_playerJump--;
} else {
if (_playerState != 0){
_playerState = 2;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = true;
};
};
if (_playerState == 2){
player_mc.y = (player_mc.y - _playerJump);
_playerJump--;
};
if (_quake > 0){
_quake = (_quake - 0.1);
this.x = ((Math.random() * _quake) - (_quake * 0.5));
if (_debrisdelay){
_debrisdelay--;
} else {
_debrisdelay = 2;
_local2 = new MC_debris();
bglvl1_mc.addChildAt(_local2, 0);
_local2.x = (Math.random() * bglvl1_mc.width);
_local2.scaleX = (_local2.scaleY = ((_quake * 0.04) * (Math.random() + 0.8)));
_local2._speed = (Math.random() + 0.4);
_debrisArray.push(_local2);
_local3 = new MC_debris();
bglvl2_mc.addChildAt(_local3, 0);
_local3.x = (Math.random() * bglvl2_mc.width);
_local3.scaleX = (_local3.scaleY = ((_quake * 0.02) * (Math.random() + 0.6)));
_local3._speed = (Math.random() + 0.2);
_debrisArray.push(_local3);
};
} else {
if (this.x != 0){
this.x = _stageInitPosX;
};
};
_debrisIndex = 0;
while (_debrisIndex < _debrisArray.length) {
_debrisArray[_debrisIndex].y = (_debrisArray[_debrisIndex].y + _debrisArray[_debrisIndex]._speed);
_debrisArray[_debrisIndex]._speed = (_debrisArray[_debrisIndex]._speed + 0.8);
_debrisArray[_debrisIndex].rotation = (_debrisArray[_debrisIndex].rotation + _debrisArray[_debrisIndex]._speed);
if (_debrisArray[_debrisIndex].y > stageArea_mc.height){
this.addChild(_debrisArray[_debrisIndex]);
removeChild(_debrisArray[_debrisIndex]);
_debrisArray.splice(_debrisIndex, 1);
};
_debrisIndex++;
};
_platformIndex = 0;
while (_platformIndex < _platformArray.length) {
_platformArray[_platformIndex].x = (_platformArray[_platformIndex].x - int((_playerSpeed + 0.5)));
_indexA = 0;
while (_indexA < _platformArray[_platformIndex].numChildren) {
if ((_platformArray[_platformIndex].x - stageArea_mc.width) < (-(_platformArray[_platformIndex].getChildAt(_indexA).width) * _indexA)){
_platformArray[_platformIndex].getChildAt(_indexA).visible = true;
};
if (_platformArray[_platformIndex].x < (-(_platformArray[_platformIndex].getChildAt(_indexA).width) * (_indexA + 1))){
_platformArray[_platformIndex].getChildAt(_indexA).visible = false;
};
if (getQualifiedClassName(_platformArray[_platformIndex].getChildAt(_indexA)) == "MC_coin"){
_platformArray[_platformIndex].getChildAt(_indexA).visible = true;
};
_indexA++;
};
if (_platformArray[_platformIndex].x < -(((_platformArray[_platformIndex].width - stageArea_mc.width) + _platformGap))){
if (_platformArray[_platformIndex]._state == 0){
_platformArray[_platformIndex]._state = 1;
createPlatform(stageArea_mc.width, (_lowPlatform + (Math.random() * (_highPlatform - _lowPlatform))), (_shortPlatform + int(((Math.random() * (_longPlatform - _shortPlatform)) + 0.5))));
};
};
if (_platformArray[_platformIndex].x < -(_platformArray[_platformIndex].width)){
removeChild(_platformArray[_platformIndex]);
_platformArray.splice(_platformIndex, 1);
};
if (_playerState != 0){
if ((((player_mc.x >= _platformArray[_platformIndex].x)) && ((player_mc.x <= (_platformArray[_platformIndex].x + _platformArray[_platformIndex].width))))){
if ((((player_mc.y >= _platformArray[_platformIndex].y)) && ((player_mc.y <= (_platformArray[_platformIndex].y - _playerJump))))){
player_mc.y = _platformArray[_platformIndex].y;
_playerState = 0;
_playerJump = 0;
_stepSnd.play();
};
};
};
if (_playerState == 0){
if (player_mc.x > (_platformArray[_platformIndex].x + _platformArray[_platformIndex].width)){
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.fall_mc.visible = true;
_playerState = 2;
};
};
_indexA = 1;
while (_indexA < _platformArray[_platformIndex].numChildren) {
if (_platformArray[_platformIndex].getChildAt(_indexA).hitTestObject(player_mc.hitArea_mc)){
if (_platformArray[_platformIndex].getChildAt(_indexA)._state == 0){
if (_platformArray[_platformIndex].getChildAt(_indexA).currentLabel == "water"){
_playerSpeed = (_playerSpeed * 0.8);
_platformArray[_platformIndex].getChildAt(_indexA)._state = 1;
_stepWetSnd.play();
} else {
if (_platformArray[_platformIndex].getChildAt(_indexA).currentLabel == "ice"){
_playerSpeed = (_playerSpeed * 1.1);
_platformArray[_platformIndex].getChildAt(_indexA)._state = 1;
_playerHitIce = true;
player_mc.hitIce_mc.gotoAndPlay(1);
_hitIceSnd.play();
} else {
if (_platformArray[_platformIndex].getChildAt(_indexA).currentLabel == "fire"){
_playerSpeed = (_playerSpeed * 0.8);
_platformArray[_platformIndex].getChildAt(_indexA)._state = 1;
_playerHitFire = true;
_playerHitFireJump = 20;
_hitFireSnd.play();
} else {
_playerSpeed = (_playerSpeed * 0.5);
_platformArray[_platformIndex].getChildAt(_indexA)._state = 1;
_playerHit = true;
player_mc.hit_mc.gotoAndPlay(1);
_hurtSnd.play();
};
};
};
};
};
_indexA++;
};
_platformIndex++;
};
if (player_mc.hit_mc.currentFrame == player_mc.hit_mc.totalFrames){
player_mc.hit_mc.visible = false;
_playerHit = false;
};
if (player_mc.hitIce_mc.currentFrame == player_mc.hitIce_mc.totalFrames){
player_mc.hitIce_mc.visible = false;
_playerHitIce = false;
};
if (_playerHit){
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = false;
player_mc.hit_mc.visible = true;
player_mc.hitFire_mc.visible = false;
player_mc.hitIce_mc.visible = false;
};
if (_playerHitIce){
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = false;
player_mc.hit_mc.visible = false;
player_mc.hitFire_mc.visible = false;
player_mc.hitIce_mc.visible = true;
};
if (_playerHitFire){
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.jump_mc.visible = false;
player_mc.fall_mc.visible = false;
player_mc.hit_mc.visible = false;
player_mc.hitFire_mc.visible = true;
player_mc.hitIce_mc.visible = false;
player_mc.y = (player_mc.y - _playerHitFireJump);
_playerHitFireJump = (_playerHitFireJump - 0.1);
if (Math.random() > 0.5){
createDust((player_mc.x + player_mc.hitFire_mc.x), ((player_mc.y + player_mc.hitFire_mc.y) - (Math.random() * 10)), ((Math.random() * 0.5) + 0.3), (-(_playerSpeed) * 0.5), ((-(Math.random()) * 0.5) + 0.3), ((Math.random() * 20) - 10));
};
};
if ((((_playerHitFireJump <= 0)) && (_playerHitFire))){
_playerHitFire = false;
player_mc.run_mc.visible = false;
player_mc.runFast_mc.visible = false;
player_mc.hitFire_mc.visible = false;
player_mc.fall_mc.visible = true;
_playerState = 2;
};
_coinIndex = 0;
while (_coinIndex < _coinArray.length) {
if (_coinArray[_coinIndex].hitTestObject(player_mc)){
_coinSnd.play();
_coinCount++;
coins_txt.text = _coinCount.toString();
this.addChild(_coinArray[_coinIndex]);
this.removeChild(_coinArray[_coinIndex]);
_coinArray.splice(_coinIndex, 1);
if (_coinCount == _nextLevel){
checkLevel();
};
};
_coinIndex++;
};
addChild(player_mc);
_dustIndex = 0;
while (_dustIndex < _dustArray.length) {
_dustArray[_dustIndex].x = (_dustArray[_dustIndex].x + _dustArray[_dustIndex]._speedX);
_dustArray[_dustIndex].y = (_dustArray[_dustIndex].y + _dustArray[_dustIndex]._speedY);
_dustArray[_dustIndex]._speedY = (_dustArray[_dustIndex]._speedY - 0.1);
_dustArray[_dustIndex].scaleX = (_dustArray[_dustIndex].scaleY = (_dustArray[_dustIndex].scaleY - ((int((Math.random() + 0.5)) * 0.02) + 0.02)));
addChild(_dustArray[_dustIndex]);
if (_dustArray[_dustIndex].scaleX <= 0){
removeChild(_dustArray[_dustIndex]);
_dustArray.splice(_dustIndex, 1);
};
_dustIndex++;
};
addChild(coin_mc);
addChild(coins_txt);
addChild(distance_txt);
addChild(mute_mc);
if (_bannerDelay > 0){
_bannerDelay--;
};
if (player_mc.y > stageArea_mc.height){
if (_playerSpeed > 0){
_playerSpeed--;
} else {
gameStop();
_quake = 15;
addEventListener(Event.ENTER_FRAME, crashAnimation);
_crashSnd.play();
};
};
}
public function createDust(_arg1:int=0, _arg2:int=0, _arg3:Number=1, _arg4:Number=1, _arg5:Number=1, _arg6:Number=10){
var _local7:MC_dust;
_local7 = new MC_dust();
addChild(_local7);
_local7.x = _arg1;
_local7.y = _arg2;
_local7.scaleX = _arg3;
_local7._speedX = _arg4;
_local7._speedY = _arg5;
_dustArray.push(_local7);
}
public function frameRate(_arg1:Event):void{
_frame++;
}
public function clickToStart(_arg1:MouseEvent):void{
var _local2:MC_readyGo;
stage.removeEventListener(MouseEvent.MOUSE_UP, clickToStart);
removeChild(MovieClip(getChildByName("clickToStart_mc")));
_local2 = new MC_readyGo();
addChild(_local2);
_local2.x = (stageArea_mc.width * 0.5);
_local2.y = (stageArea_mc.height * 0.5);
_local2.name = "readyGo_mc";
_local2.addEventListener(Event.ENTER_FRAME, readyGoAnim);
}
}
}//package benrunrunnow_secure_fla
Section 3
//MC_player_6 (benrunrunnow_secure_fla.MC_player_6)
package benrunrunnow_secure_fla {
import flash.display.*;
public dynamic class MC_player_6 extends MovieClip {
public var hitFire_mc:MovieClip;
public var hitIce_mc:MovieClip;
public var runFast_mc:MovieClip;
public var jump_mc:MovieClip;
public var hitArea_mc:MovieClip;
public var hit_mc:MovieClip;
public var run_mc:MovieClip;
public var fall_mc:MovieClip;
public var idle_mc:MovieClip;
}
}//package benrunrunnow_secure_fla
Section 4
//MC_playerJump_15 (benrunrunnow_secure_fla.MC_playerJump_15)
package benrunrunnow_secure_fla {
import flash.display.*;
public dynamic class MC_playerJump_15 extends MovieClip {
public function MC_playerJump_15(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package benrunrunnow_secure_fla
Section 5
//MC_backgroundLvl1 (MC_backgroundLvl1)
package {
import flash.display.*;
public dynamic class MC_backgroundLvl1 extends MovieClip {
}
}//package
Section 6
//MC_backgroundLvl2 (MC_backgroundLvl2)
package {
import flash.display.*;
public dynamic class MC_backgroundLvl2 extends MovieClip {
}
}//package
Section 7
//MC_banner (MC_banner)
package {
import flash.display.*;
public dynamic class MC_banner extends MovieClip {
}
}//package
Section 8
//MC_clickToStart (MC_clickToStart)
package {
import flash.display.*;
public dynamic class MC_clickToStart extends MovieClip {
}
}//package
Section 9
//MC_coin (MC_coin)
package {
import flash.display.*;
public dynamic class MC_coin extends MovieClip {
public var coinShadow_mc:MovieClip;
}
}//package
Section 10
//MC_debris (MC_debris)
package {
import flash.display.*;
public dynamic class MC_debris extends Sprite {
}
}//package
Section 11
//MC_decal (MC_decal)
package {
import flash.display.*;
public dynamic class MC_decal extends MovieClip {
}
}//package
Section 12
//MC_dust (MC_dust)
package {
import flash.display.*;
public dynamic class MC_dust extends MovieClip {
}
}//package
Section 13
//MC_levelUpEffect (MC_levelUpEffect)
package {
import flash.display.*;
public dynamic class MC_levelUpEffect extends MovieClip {
public var flash_mc:MovieClip;
}
}//package
Section 14
//MC_obstacle (MC_obstacle)
package {
import flash.display.*;
public dynamic class MC_obstacle extends MovieClip {
}
}//package
Section 15
//MC_readyGo (MC_readyGo)
package {
import flash.display.*;
public dynamic class MC_readyGo extends MovieClip {
}
}//package
Section 16
//MC_retry (MC_retry)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MC_retry extends MovieClip {
public var distance_txt:TextField;
public var level_txt:TextField;
public var score_txt:TextField;
public var coins_txt:TextField;
}
}//package
Section 17
//SND_coin (SND_coin)
package {
import flash.media.*;
public dynamic class SND_coin extends Sound {
}
}//package
Section 18
//SND_crash (SND_crash)
package {
import flash.media.*;
public dynamic class SND_crash extends Sound {
}
}//package
Section 19
//SND_fall (SND_fall)
package {
import flash.media.*;
public dynamic class SND_fall extends Sound {
}
}//package
Section 20
//SND_hitFire (SND_hitFire)
package {
import flash.media.*;
public dynamic class SND_hitFire extends Sound {
}
}//package
Section 21
//SND_hitIce (SND_hitIce)
package {
import flash.media.*;
public dynamic class SND_hitIce extends Sound {
}
}//package
Section 22
//SND_hurt (SND_hurt)
package {
import flash.media.*;
public dynamic class SND_hurt extends Sound {
}
}//package
Section 23
//SND_jump (SND_jump)
package {
import flash.media.*;
public dynamic class SND_jump extends Sound {
}
}//package
Section 24
//SND_LVLUP (SND_LVLUP)
package {
import flash.media.*;
public dynamic class SND_LVLUP extends Sound {
}
}//package
Section 25
//SND_quake (SND_quake)
package {
import flash.media.*;
public dynamic class SND_quake extends Sound {
}
}//package
Section 26
//SND_step (SND_step)
package {
import flash.media.*;
public dynamic class SND_step extends Sound {
}
}//package
Section 27
//SND_stepWet (SND_stepWet)
package {
import flash.media.*;
public dynamic class SND_stepWet extends Sound {
}
}//package