Section 1
//MC_POGO_GAME_1 (pula_pula_fla.MC_POGO_GAME_1)
package pula_pula_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MC_POGO_GAME_1 extends MovieClip {
public var _shotArray:Array;
public var _playerInitPos:Point;
public var linkShare:String;
public var _checkPointIndex:int;
public var _levelHeight:int;
public var _gravity:Number;
public var firstPlatform_mc:MC_platform;
public var _winSnd:SND_win;
public var timerIcon_mc:MovieClip;
public var _enemyChance:Number;
public var _platformIndex:int;
public var timeLeft_txt:TextField;
public var logos:MovieClip;
public var _bounceState:int;
public var _flagSnd:SND_flag;
public var _playerHurt:int;
public var _firstPlatformInitPos:Point;
public var _coinIndex:int;
public var ghost_mc:MovieClip;
public var _playerHealthMax:int;
public var _currentCheckPoint:MovieClip;
public var tapume:MovieClip;
public var coinIcon_mc:MovieClip;
public var _totalScore:int;
public var darkness_mc:MovieClip;
public var _decalArray:Array;
public var _checkPointGap:int;
public var _enemyArray:Array;
public var _pickup3Snd:SND_pickup3;
public var health_mc:MovieClip;
public var _bounceSnd:SND_bounce;
public var _levelIndex:int;
public var _timer:Timer;
public var _speed:Number;
public var _currentLevel:int;
public var telaJogar:TelaJogar;
public var _enemyTypes:Number;
public var _popSnd:SND_pop;
public var _shotIndex:int;
public var _playerHealth:int;
public var _hurtSnd:SND_hurt;
public var _pickup1Snd:SND_pickup1;
public var star_mc:MC_star;
public var stageArea_mc:MovieClip;
public var _platformArray:Array;
public var coins_txt:TextField;
public var player_mc:MovieClip;
public var _totalCoins:int;
public var _checkPointArray:Array;
public var _decalIndex:int;
public var _coinArray:Array;
public var _totalHeight:int;
public var _currentPlatform:MovieClip;
public var BG_mc:MovieClip;
public var _timeLeft:int;
public var _levelArray:Array;
public var _loseSnd:SND_lose;
public var gameOverBl:Boolean;
public var _enemyIndex:int;
public var txtLevel:TextField;
public var _hitSnd:SND_hit;
public var _jumpPower:Number;
public var _pickup2Snd:SND_pickup2;
public var nuvens:MovieClip;
public function MC_POGO_GAME_1(){
addFrameScript(0, frame1);
}
public function movePlatformsLayer(_arg1:Number):void{
nuvens.y = (nuvens.y + (_arg1 / 2));
_platformIndex = (_platformArray.length - 1);
while (_platformIndex >= 0) {
_platformArray[_platformIndex].y = (_platformArray[_platformIndex].y + _arg1);
if ((((_platformArray[_platformIndex].y > (stageArea_mc.y - _platformArray[_platformIndex].height))) && ((_platformArray[_platformIndex].y < (stageArea_mc.y + stageArea_mc.height))))){
if (_platformArray[_platformIndex].visible == false){
_platformArray[_platformIndex].visible = true;
_platformArray[_platformIndex].cacheAsBitmap = true;
};
};
_platformIndex--;
};
}
public function quality(_arg1:MouseEvent):void{
stage.quality = "high";
}
public function enemyBehaviour():void{
var _local1:MC_shot;
_enemyIndex = 0;
while (_enemyIndex < _enemyArray.length) {
_enemyArray[_enemyIndex].x = (_enemyArray[_enemyIndex].x + (_enemyArray[_enemyIndex]._speed * _enemyArray[_enemyIndex]._direction));
if (_enemyArray[_enemyIndex].x < _enemyArray[_enemyIndex]._platform.x){
_enemyArray[_enemyIndex]._direction = 1;
_enemyArray[_enemyIndex].scaleX = -1;
} else {
if (_enemyArray[_enemyIndex].x > (_enemyArray[_enemyIndex]._platform.x + _enemyArray[_enemyIndex]._platform.width)){
_enemyArray[_enemyIndex]._direction = -1;
_enemyArray[_enemyIndex].scaleX = 1;
};
};
if (_enemyArray[_enemyIndex]._shotSpeed > 0){
if (_enemyArray[_enemyIndex]._shotDelay > 0){
_enemyArray[_enemyIndex]._shotDelay--;
} else {
_enemyArray[_enemyIndex]._shotDelay = (Math.round((Math.random() * (_enemyArray[_enemyIndex]._shotDelayMax - _enemyArray[_enemyIndex]._shotDelayMin))) + _enemyArray[_enemyIndex]._shotDelayMin);
_local1 = new MC_shot();
addChild(_local1);
_local1.x = (_enemyArray[_enemyIndex].x + (_enemyArray[_enemyIndex]._shotOffset.x * -(_enemyArray[_enemyIndex]._direction)));
_local1.y = (_enemyArray[_enemyIndex].y + _enemyArray[_enemyIndex]._shotOffset.y);
_local1._speed = _enemyArray[_enemyIndex]._shotSpeed;
_local1._direction = -(_enemyArray[_enemyIndex].scaleX);
_local1.scaleX = _enemyArray[_enemyIndex].scaleX;
_local1.cacheAsBitmap = true;
_shotArray.push(_local1);
explodeDust(_local1);
};
};
if ((((_enemyArray[_enemyIndex]._damage == true)) && ((_playerHurt == 0)))){
if (player_mc.hurtArea_mc.hitTestPoint(_enemyArray[_enemyIndex].x, _enemyArray[_enemyIndex].y)){
hurtPlayer();
if (_playerHealth <= 0){
gameOver();
};
_hurtSnd.play();
};
};
if (_jumpPower < 0){
if (player_mc.hitArea_mc.hitTestObject(_enemyArray[_enemyIndex])){
player_mc.gotoAndPlay("bounceOut");
player_mc.head_mc.gotoAndStop((Math.round((Math.random() * player_mc.head_mc.totalFrames)) - 1));
_bounceState = 0;
if (_enemyArray[_enemyIndex]._health > 1){
_jumpPower = 5;
_enemyArray[_enemyIndex]._health--;
explodeDust(player_mc);
_hitSnd.play();
} else {
_jumpPower = _enemyArray[_enemyIndex]._jumpPower;
explodeDust(_enemyArray[_enemyIndex], 30, -6, 6, 1, 1.5, -0.1, -0.2);
explodeCoins(_enemyArray[_enemyIndex], _enemyArray[_enemyIndex]._coins, 10);
coins_txt.text = _totalCoins.toString();
_enemyArray[_enemyIndex].addEventListener(Event.ENTER_FRAME, enemyDeathAnimation);
_enemyArray.splice(_enemyIndex, 1);
_popSnd.play();
};
};
};
_enemyIndex++;
};
}
public function checkPoints():void{
_checkPointIndex = 0;
while (_checkPointIndex < _checkPointArray.length) {
if (((player_mc.hitArea_mc.hitTestObject(_checkPointArray[_checkPointIndex])) && ((_checkPointArray[_checkPointIndex].pickedUp == false)))){
_checkPointArray[_checkPointIndex].pickedUp = true;
_checkPointArray[_checkPointIndex].play();
_currentCheckPoint = _checkPointArray[_checkPointIndex];
if (_playerHealth < _playerHealthMax){
_playerHealth++;
};
health_mc.gotoAndStop(Math.round(((_playerHealth / _playerHealthMax) * health_mc.totalFrames)));
_flagSnd.play();
};
_checkPointIndex++;
};
if (_currentCheckPoint != null){
createTwinkle(_currentCheckPoint, -3, -6);
};
}
public function endLevelAnimation(_arg1:Event):void{
addChild(MovieClip(_arg1.target));
if (_arg1.target.alpha < 1){
_arg1.target.alpha = (_arg1.target.alpha + 0.1);
} else {
if (_totalCoins > 0){
if (_totalCoins > 10000){
_totalCoins = (_totalCoins - 5000);
_totalScore = (_totalScore + 50000);
} else {
if (_totalCoins > 1000){
_totalCoins = (_totalCoins - 500);
_totalScore = (_totalScore + 5000);
} else {
if (_totalCoins > 100){
_totalCoins = (_totalCoins - 50);
_totalScore = (_totalScore + 500);
} else {
if (_totalCoins > 10){
_totalCoins = (_totalCoins - 5);
_totalScore = (_totalScore + 50);
} else {
_totalCoins = (_totalCoins - 1);
_totalScore = (_totalScore + 10);
};
};
};
};
_arg1.target.coins_txt.text = _totalCoins.toString();
_arg1.target.totalScore_txt.text = _totalScore.toString();
} else {
if (_timeLeft > 0){
if (_timeLeft > 100){
_timeLeft = (_timeLeft - 50);
_totalScore = (_totalScore + 1000);
} else {
if (_timeLeft > 10){
_timeLeft = (_timeLeft - 5);
_totalScore = (_totalScore + 100);
} else {
_timeLeft = (_timeLeft - 1);
_totalScore = (_totalScore + 20);
};
};
_arg1.target.timeLeft_txt.text = _timeLeft.toString();
_arg1.target.totalScore_txt.text = _totalScore.toString();
} else {
_arg1.target.removeEventListener(Event.ENTER_FRAME, endLevelAnimation);
_arg1.currentTarget.nextStageBt.addEventListener(MouseEvent.CLICK, restartLevel);
};
};
};
}
public function moveCoinsLayer(_arg1:Number):void{
_coinIndex = 0;
while (_coinIndex < _coinArray.length) {
_coinArray[_coinIndex].y = (_coinArray[_coinIndex].y + _arg1);
if ((((_coinArray[_coinIndex].y > stageArea_mc.y)) && ((_coinArray[_coinIndex].y < ((stageArea_mc.y + stageArea_mc.height) + _coinArray[_coinIndex].height))))){
if (_coinArray[_coinIndex].visible == false){
_coinArray[_coinIndex].visible = true;
_coinArray[_coinIndex].cacheAsBitmap = true;
};
} else {
_coinArray[_coinIndex].visible = false;
};
_coinIndex++;
};
}
public function enemyDeathAnimation(_arg1:Event):void{
_arg1.target.scaleY = (_arg1.target.scaleY * 0.6);
if (_arg1.target.scaleY < 0.1){
_arg1.target.removeEventListener(Event.ENTER_FRAME, enemyDeathAnimation);
removeChild(MovieClip(_arg1.target));
};
}
public function explodeDust(_arg1:MovieClip, _arg2:int=10, _arg3:Number=-4, _arg4:Number=4, _arg5:Number=0.8, _arg6:Number=1.2, _arg7:Number=-0.08, _arg8:Number=-0.16):void{
var _local10:MC_dust;
var _local9:* = 0;
while (_local9 < _arg2) {
_local10 = new MC_dust();
addChild(_local10);
_local10.x = _arg1.x;
_local10.y = _arg1.y;
_local10._speedX = ((Math.random() * (_arg4 - _arg3)) + _arg3);
_local10._speedY = ((Math.random() * (_arg4 - _arg3)) + _arg3);
_local10.scaleX = (_local10.scaleY = ((Math.random() * (_arg6 - _arg5)) + _arg5));
_local10._sizeChange = ((Math.random() * (_arg8 - _arg7)) + _arg7);
_local10.addEventListener(Event.ENTER_FRAME, explodeDustAnimation);
_local9++;
};
}
public function gameOverWin(){
trace("GAME OVER WIN");
var _local1:MC_gameOverScreen = new MC_gameOverScreen();
this.addChild(_local1);
_local1.alpha = 0;
_local1.finalScore_mc.finalScore_txt.selectable = false;
_local1.finalScore_mc.finalScore_txt.text = _totalScore.toString();
_currentLevel = 0;
_levelHeight = 0;
_totalCoins = 0;
_totalHeight = 0;
_playerHurt = 0;
_playerHealthMax = 5;
_enemyChance = 0.18;
_enemyTypes = 0.1;
_local1.addEventListener(Event.ENTER_FRAME, gameOverAnimationEnd);
}
public function mostraAjuda(_arg1:MouseEvent){
telaJogar = new TelaJogar();
this.addChild(telaJogar);
telaJogar.btnClose.buttonMode = true;
telaJogar.btnClose.addEventListener(MouseEvent.CLICK, fechaAjuda);
trace("mostraAjuda");
}
public function gameOverAnimation(_arg1:Event):void{
player_mc.x = (player_mc.x + (10 * player_mc._direction));
player_mc.y = (player_mc.y + player_mc._fallSpeed);
player_mc._fallSpeed = (player_mc._fallSpeed + _gravity);
player_mc.rotation = (player_mc.rotation + (player_mc._direction * 3));
if (player_mc.y > ((stageArea_mc.y + stageArea_mc.height) + player_mc.height)){
addChild(MovieClip(_arg1.target));
if (_arg1.target.alpha < 2){
_arg1.target.alpha = (_arg1.target.alpha + 0.1);
} else {
gameOverBl = true;
_timer.stop();
_arg1.target.removeEventListener(Event.ENTER_FRAME, gameOverAnimation);
_arg1.target.btnRestart.mouseChildren = false;
_arg1.target.btnRestart.buttonMode = true;
_arg1.target.btnRestart.addEventListener(MouseEvent.CLICK, restartLevel);
_totalScore = 0;
_levelArray = [];
};
};
}
public function moveEnemiesLayer(_arg1:Number):void{
_enemyIndex = 0;
while (_enemyIndex < _enemyArray.length) {
_enemyArray[_enemyIndex].y = (_enemyArray[_enemyIndex].y + _arg1);
if ((((_enemyArray[_enemyIndex].y > stageArea_mc.y)) && ((_enemyArray[_enemyIndex].y < ((stageArea_mc.y + stageArea_mc.height) + _enemyArray[_enemyIndex].height))))){
if (_enemyArray[_enemyIndex].visible == false){
_enemyArray[_enemyIndex].visible = true;
_enemyArray[_enemyIndex].cacheAsBitmap = true;
};
} else {
_enemyArray[_enemyIndex].visible = false;
};
_enemyIndex++;
};
}
public function timer(_arg1:TimerEvent){
var _local2:String;
if (_timeLeft > 0){
_timeLeft--;
_local2 = _timeLeft.toString();
timeLeft_txt.text = _local2;
} else {
_timer.stop();
addChild(ghost_mc);
ghost_mc.addEventListener(Event.ENTER_FRAME, ghostAnimation);
};
}
public function fallAnimation(_arg1:Event):void{
_arg1.target.x = (_arg1.target.x - (_arg1.target._speed * _arg1.target._direction));
_arg1.target.y = (_arg1.target.y + _arg1.target._fallSpeed);
_arg1.target._fallSpeed = (_arg1.target._fallSpeed + _gravity);
_arg1.target.rotation = (_arg1.target.rotation + ((_arg1.target._speed * _arg1.target._direction) * 10));
if (_arg1.target.y > stageArea_mc.height){
_arg1.target.removeEventListener(Event.ENTER_FRAME, fallAnimation);
removeChild(MovieClip(_arg1.target));
};
}
function frame1(){
linkShare = "http://www.facebook.com.br/sharer.php?u=http://www.google.com.br";
_playerInitPos = new Point(player_mc.x, player_mc.y);
_firstPlatformInitPos = new Point(firstPlatform_mc.x, firstPlatform_mc.y);
_speed = 0.1;
_jumpPower = 0;
_gravity = 1;
_bounceState = 0;
_playerHealthMax = 5;
_playerHurt = 0;
_platformArray = new Array(firstPlatform_mc);
_platformIndex = 0;
_currentPlatform = firstPlatform_mc;
_coinArray = new Array();
_coinIndex = 0;
_decalArray = new Array();
_decalIndex = 0;
_enemyArray = new Array();
_enemyIndex = 0;
_shotArray = new Array();
_shotIndex = 0;
_checkPointArray = new Array();
_checkPointIndex = 0;
_checkPointGap = 6;
_levelArray = new Array();
_levelIndex = 0;
_totalCoins = 0;
_totalHeight = 0;
_levelHeight = 3;
_timer = new Timer(1000);
_currentLevel = 1;
_totalScore = 0;
_enemyChance = 0.2;
_enemyTypes = 0.5;
_bounceSnd = new SND_bounce();
_pickup1Snd = new SND_pickup1();
_pickup2Snd = new SND_pickup2();
_pickup3Snd = new SND_pickup3();
_flagSnd = new SND_flag();
_popSnd = new SND_pop();
_hitSnd = new SND_hit();
_hurtSnd = new SND_hurt();
_winSnd = new SND_win();
_loseSnd = new SND_lose();
gameOverBl = false;
initialization();
_timer.addEventListener(TimerEvent.TIMER, timer);
}
public function fechaAjuda(_arg1:MouseEvent){
this.removeChild(telaJogar);
}
public function startGameClick(_arg1:MouseEvent):void{
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, startGameClick);
removeChild(MovieClip(_arg1.currentTarget.parent));
startGame();
}
public function createCoins(_arg1:MovieClip, _arg2:Number=0.02):void{
var _local5:MC_coin;
var _local3:int = Math.round((_arg1.width * _arg2));
var _local4:int;
while (_local4 < _local3) {
_local5 = new MC_coin();
addChildAt(_local5, _arg1.index);
_local5.x = (_arg1.x + (_local4 * Math.round((_arg1.width / _local3))));
_local5.x = (_local5.x + ((_arg1.width - ((_local3 - 1) * Math.round((_arg1.width / _local3)))) * 0.5));
_local5.y = _arg1.y;
_local5.y = (_local5.y - 40);
_local5.pickedUp = false;
_local5.gotoAndStop(Math.round((Math.random() * _local5.totalFrames)));
_local5.cacheAsBitmap = true;
_coinArray.push(_local5);
_local4++;
};
}
public function startGame(){
_bounceState = 2;
player_mc.gotoAndPlay(1);
player_mc.head_mc.gotoAndStop(1);
player_mc.alpha = 1;
player_mc.rotation = 0;
player_mc.x = _playerInitPos.x;
player_mc.y = _playerInitPos.y;
firstPlatform_mc.x = _firstPlatformInitPos.x;
firstPlatform_mc.y = _firstPlatformInitPos.y;
firstPlatform_mc.visible = true;
_currentCheckPoint = null;
createLevel(_levelHeight, 100, 300, _checkPointGap);
movePlatformsLayer(0);
moveCoinsLayer(0);
moveShotsLayer(0);
moveCheckPointsLayer(0);
moveDecalsLayer(0);
addChildAt(BG_mc, 0);
_playerHurt = 0;
_totalCoins = 0;
coins_txt.text = _totalCoins.toString();
var _local1:MC_readyGo = new MC_readyGo();
addChild(_local1);
_local1.x = (stageArea_mc.width * 0.5);
_local1.y = (stageArea_mc.height * 0.3);
_local1.name = "readyGo_mc";
_local1.addEventListener(Event.ENTER_FRAME, readyGoAnim);
_timer.start();
}
public function createEnemies(_arg1:MovieClip, _arg2:Number=0.04, _arg3:Number=0.01, _arg4:Number=0.5):void{
var _local7:MC_enemy;
var _local5:int = Math.round((_arg1.width * _arg3));
var _local6:int;
while (_local6 < _local5) {
if ((((Math.random() <= _arg2)) && ((_arg1.y < stageArea_mc.y)))){
_local7 = new MC_enemy();
addChild(_local7);
_local7.x = (_arg1.x + (_local6 * Math.round((_arg1.width / _local5))));
_local7.x = (_local7.x + ((_arg1.width - ((_local5 - 1) * Math.round((_arg1.width / _local5)))) * 0.5));
_local7.y = _arg1.y;
_local7.gotoAndStop(Math.round((_arg4 * Math.random())));
switch (_local7.currentFrame){
case 1:
_local7._speed = 0;
_local7._jumpPower = 10;
_local7._coins = 10;
_local7._platform = _arg1;
_local7._damage = true;
break;
case 2:
_local7._speed = 4;
_local7._jumpPower = 15;
_local7._coins = 20;
_local7._platform = stageArea_mc;
_local7._damage = true;
break;
case 3:
_local7._speed = 1;
_local7._jumpPower = 20;
_local7._coins = 30;
_local7._platform = _arg1;
_local7._damage = true;
_local7._health = 2;
break;
case 4:
_local7._speed = 0;
_local7._jumpPower = 25;
_local7._coins = 40;
_local7._platform = _arg1;
_local7._damage = true;
_local7._health = 3;
_local7._shotSpeed = 5;
_local7._shotDelay = 96;
_local7._shotDelayMin = 64;
_local7._shotDelayMax = 128;
_local7._shotOffset = new Point(-40, -40);
break;
default:
_local7._speed = 2;
_local7._jumpPower = 10;
_local7._coins = 10;
_local7._platform = _arg1;
_local7._damage = true;
};
if (Math.random() > 0.5){
_local7._direction = 1;
_local7.scaleX = -1;
} else {
_local7._direction = -1;
_local7.scaleX = 1;
};
_local7.cacheAsBitmap = true;
_enemyArray.push(_local7);
};
_local6++;
};
}
public function createPlatform(_arg1:int=0, _arg2:int=200, _arg3:int=300){
var _local4:MC_platform = new MC_platform();
addChildAt(_local4, 0);
_local4.width = Math.round(((Math.random() * (_arg3 - _arg2)) + _arg2));
_local4.x = (Math.random() * (stageArea_mc.width - _local4.width));
_local4.height = stageArea_mc.height;
_local4.y = _arg1;
_local4.firstPlataform2.visible = false;
var _local5:ColorTransform = _local4.grass_mc.transform.colorTransform;
_local5.redMultiplier = (Math.random() + 0.5);
_local5.blueMultiplier = (Math.random() + 0.5);
_local4.grass_mc.transform.colorTransform = _local5;
_local4.cacheAsBitmap = true;
_platformArray.push(_local4);
createEnemies(_local4, _enemyChance, 0.01, _enemyTypes);
createCoins(_local4);
}
public function explodeDustAnimation(_arg1:Event):void{
_arg1.target.x = (_arg1.target.x + _arg1.target._speedX);
_arg1.target.y = (_arg1.target.y + _arg1.target._speedY);
_arg1.target._speedX = (_arg1.target._speedX * 0.9);
_arg1.target._speedY = (_arg1.target._speedY * 0.9);
_arg1.target.scaleX = (_arg1.target.scaleY = (_arg1.target.scaleY + _arg1.target._sizeChange));
if (_arg1.target.scaleX < 0.1){
_arg1.target.removeEventListener(Event.ENTER_FRAME, explodeDustAnimation);
removeChild(MovieClip(_arg1.target));
};
}
public function checkCoinPickup():void{
_coinIndex = 0;
while (_coinIndex < _coinArray.length) {
if (((player_mc.hitArea_mc.hitTestObject(_coinArray[_coinIndex])) && ((_coinArray[_coinIndex].pickedUp == false)))){
_coinArray[_coinIndex].pickedUp = true;
_coinArray[_coinIndex].addEventListener(Event.ENTER_FRAME, coinPickupAnimation);
_coinArray.splice(_coinIndex, 1);
if (Math.random() > 0.65){
_pickup1Snd.play();
} else {
if (Math.random() > 0.5){
_pickup2Snd.play();
} else {
_pickup3Snd.play();
};
};
};
_coinIndex++;
};
}
public function createCheckpoint(_arg1:MovieClip):void{
}
public function readyGoAnim(_arg1:Event):void{
this.addChild(MovieClip(_arg1.target));
if (_arg1.target.currentFrame == 30){
addEventListener(Event.ENTER_FRAME, animation);
};
if (_arg1.target.currentFrame == _arg1.target.totalFrames){
_arg1.target.removeEventListener(Event.ENTER_FRAME, readyGoAnim);
this.removeChild(MovieClip(_arg1.target));
};
}
public function changeDifficulty(_arg1:int=3, _arg2:Number=0.02, _arg3:Number=0.4, _arg4:int=1){
_levelHeight = (_levelHeight + _arg1);
_enemyChance = (_enemyChance + _arg2);
_enemyTypes = (_enemyTypes + _arg3);
_checkPointGap = (_checkPointGap + _arg4);
}
public function explodeCoins(_arg1:MovieClip, _arg2:int, _arg3:Number=3):void{
var _local6:MC_coin;
var _local4:Number = (360 / _arg2);
var _local5:* = 0;
while (_local5 < _arg2) {
_local6 = new MC_coin();
addChild(_local6);
_local6.x = _arg1.x;
_local6.y = _arg1.y;
_local6._degree = (((_local4 * _local5) / 180) * Math.PI);
_local6._speed = _arg3;
_local6.gotoAndStop(Math.round((Math.random() * _local6.totalFrames)));
_local6.pickedUp = false;
_local6.addEventListener(Event.ENTER_FRAME, explodeCoinAnimation);
_local5++;
};
}
public function restartLevel(_arg1:MouseEvent):void{
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, restartLevel);
if (gameOverBl == false){
removeChild(MovieClip(_arg1.currentTarget.parent));
} else {
removeChild(MovieClip(_arg1.currentTarget.parent));
gameOverBl = false;
};
while (_platformArray.length > 1) {
removeChild(_platformArray.pop());
};
while (_coinArray.length > 0) {
removeChild(_coinArray.pop());
};
while (_decalArray.length > 0) {
removeChild(_decalArray.pop());
};
while (_enemyArray.length > 0) {
removeChild(_enemyArray.pop());
};
while (_checkPointArray.length > 0) {
removeChild(_checkPointArray.pop());
};
while (_shotArray.length > 0) {
removeChild(_shotArray.pop());
};
_currentLevel++;
changeDifficulty();
startGame();
}
public function twinkleAnimation(_arg1:Event):void{
_arg1.target.alpha = (_arg1.target.alpha + 0.08);
_arg1.target.y = (_arg1.target.y + _arg1.target._speedY);
_arg1.target._speedY = (_arg1.target._speedY * 0.9);
_arg1.target.rotation = (_arg1.target.rotation + _arg1.target._rotationSpeed);
_arg1.target.scaleX = (_arg1.target.scaleY = (_arg1.target.scaleY + _arg1.target._sizeChange));
if (_arg1.target.scaleX < 0.1){
_arg1.target.removeEventListener(Event.ENTER_FRAME, twinkleAnimation);
removeChild(MovieClip(_arg1.target));
};
}
public function initialization():void{
tapume.visible = false;
this.removeChild(tapume);
stageArea_mc.visible = false;
player_mc.hitArea_mc.visible = false;
player_mc.hurtArea_mc.visible = false;
coins_txt.selectable = false;
timeLeft_txt.selectable = false;
player_mc.head_mc.gotoAndStop(1);
var _local1:MC_gameStartScreen = new MC_gameStartScreen();
addChild(_local1);
_local1.btnHelp.buttonMode = true;
_local1.btnHelp.addEventListener(MouseEvent.CLICK, mostraAjuda);
_local1.btnJogar.buttonMode = true;
_local1.btnJogar.addEventListener(MouseEvent.MOUSE_UP, startGameClick);
}
public function ghostAnimation(_arg1:Event):void{
if (darkness_mc.alpha < 1){
darkness_mc.alpha = (darkness_mc.alpha + 0.01);
};
_arg1.target.x = (_arg1.target.x - ((_arg1.target.x - player_mc.x) * 0.06));
_arg1.target.y = (_arg1.target.y - ((_arg1.target.y - (player_mc.y - (player_mc.height * 0.5))) * 0.06));
_arg1.target.y = (_arg1.target.y + _jumpPower);
if (_playerHurt == 0){
if (player_mc.hurtArea_mc.hitTestPoint(_arg1.target.x, _arg1.target.y)){
hurtPlayer();
if (_playerHealth <= 0){
gameOver();
};
_hurtSnd.play();
};
};
}
public function createTwinkle(_arg1:MovieClip, _arg2:Number=3, _arg3:Number=6, _arg4:Number=1, _arg5:Number=2, _arg6:Number=-0.05, _arg7:Number=-0.1, _arg8:int=10, _arg9:int=20):void{
var _local10:MC_twinkle = new MC_twinkle();
addChild(_local10);
_local10.x = ((_arg1.x + (Math.random() * _arg1.width)) - (0.5 * _arg1.width));
_local10.y = ((_arg1.y + (Math.random() * _arg1.height)) - (0.5 * _arg1.height));
_local10._speedY = ((Math.random() * (_arg3 - _arg2)) + _arg2);
_local10._rotationSpeed = ((Math.random() * (_arg9 - _arg8)) + _arg8);
_local10.scaleX = (_local10.scaleY = ((Math.random() * (_arg5 - _arg4)) + _arg4));
_local10._sizeChange = ((Math.random() * (_arg7 - _arg6)) + _arg6);
_local10.alpha = 0;
_local10.addEventListener(Event.ENTER_FRAME, twinkleAnimation);
}
public function shareFacebook(_arg1:MouseEvent){
navigateToURL(new URLRequest(linkShare), "_blank");
}
public function animation(_arg1:Event):void{
var _local2:MC_scoreScreen;
var _local3:Number;
if (player_mc.currentFrame == player_mc.totalFrames){
player_mc.gotoAndStop(1);
player_mc.head_mc.gotoAndStop((Math.round((Math.random() * player_mc.head_mc.totalFrames)) - 1));
_bounceState = 1;
if (_jumpPower <= 0){
_jumpPower = 15;
};
};
if (_bounceState == 1){
player_mc.x = (player_mc.x - ((player_mc.x - mouseX) * _speed));
if (player_mc.x > (stageArea_mc.x + stageArea_mc.width)){
player_mc.x = (stageArea_mc.x + stageArea_mc.width);
};
if (player_mc.x < stageArea_mc.x){
player_mc.x = stageArea_mc.x;
};
if (_currentPlatform != null){
if ((player_mc.y - _jumpPower) > _currentPlatform.y){
_totalHeight = (_totalHeight - (player_mc.y - _currentPlatform.y));
moveCoinsLayer((player_mc.y - _currentPlatform.y));
moveDecalsLayer((player_mc.y - _currentPlatform.y));
moveShotsLayer((player_mc.y - _currentPlatform.y));
moveEnemiesLayer((player_mc.y - _currentPlatform.y));
moveCheckPointsLayer((player_mc.y - _currentPlatform.y));
movePlatformsLayer((player_mc.y - _currentPlatform.y));
player_mc.y = _currentPlatform.y;
_bounceState = 2;
_jumpPower = 0;
player_mc.play();
explodeDust(player_mc);
_bounceSnd.play();
} else {
if (_currentCheckPoint != null){
if (player_mc.y > _currentCheckPoint.y){
_jumpPower = (_jumpPower + 2);
createTwinkle(player_mc, -3, -6);
};
};
if (_jumpPower <= 0){
checkCurrentPlatform();
};
_totalHeight = (_totalHeight - _jumpPower);
movePlatformsLayer(_jumpPower);
moveCoinsLayer(_jumpPower);
moveShotsLayer(_jumpPower);
moveDecalsLayer(_jumpPower);
moveEnemiesLayer(_jumpPower);
moveCheckPointsLayer(_jumpPower);
_jumpPower = (_jumpPower - _gravity);
};
};
};
player_mc.rotation = ((mouseX - player_mc.x) * 0.1);
checkCoinPickup();
enemyBehaviour();
shotBehaviour();
checkPoints();
if (_totalHeight <= 0){
star_mc.y = (star_mc.y - ((star_mc.y - (stageArea_mc.height * 0.5)) * 0.1));
createTwinkle(star_mc);
if (player_mc.hitTestPoint(star_mc.x, star_mc.y, true)){
removeEventListener(Event.ENTER_FRAME, animation);
_timer.stop();
star_mc.y = (-(star_mc.height) * 2);
if (_currentLevel < 10){
_local2 = new MC_scoreScreen();
addChild(_local2);
_local2.alpha = 0;
_local2.coins_txt.text = _totalCoins.toString();
_local2.timeLeft_txt.text = _timeLeft.toString();
_local2.totalScore_txt.text = _totalScore.toString();
_local2.coins_txt.selectable = false;
_local2.timeLeft_txt.selectable = false;
_local2.totalScore_txt.selectable = false;
_local2.addEventListener(Event.ENTER_FRAME, endLevelAnimation);
} else {
_local3 = ((10 * _totalCoins) + (20 * _timeLeft));
_totalScore = (_totalScore + _local3);
gameOverWin();
};
_winSnd.play();
};
} else {
star_mc.y = (star_mc.y - ((star_mc.y + star_mc.height) * 0.1));
};
if (_playerHurt > 0){
_playerHurt--;
if ((_playerHurt % 4)){
player_mc.alpha = 0;
} else {
player_mc.alpha = 1;
};
};
addChild(coinIcon_mc);
addChild(timerIcon_mc);
addChild(timeLeft_txt);
addChild(coins_txt);
addChild(health_mc);
addChild(player_mc);
addChild(txtLevel);
addChild(logos);
addChildAt(nuvens, 0);
addChildAt(BG_mc, 0);
}
public function explodeCoinAnimation(_arg1:Event):void{
_arg1.target.x = (_arg1.target.x + (Math.cos(_arg1.target._degree) * _arg1.target._speed));
_arg1.target.y = (_arg1.target.y + (Math.sin(_arg1.target._degree) * _arg1.target._speed));
_arg1.target._speed = (_arg1.target._speed * 0.9);
if ((((_arg1.target._speed < (0.3 + _arg1.target._degree))) && ((_arg1.target.pickedUp == false)))){
_arg1.target.pickedUp = true;
_arg1.target.addEventListener(Event.ENTER_FRAME, coinPickupAnimation);
};
}
public function coinPickupAnimation(_arg1:Event):void{
if ((((Math.abs((_arg1.target.x - coinIcon_mc.x)) > 5)) && ((Math.abs((_arg1.target.y - coinIcon_mc.y)) > 5)))){
_arg1.target.x = (_arg1.target.x - ((_arg1.target.x - coinIcon_mc.x) * 0.1));
_arg1.target.y = (_arg1.target.y - ((_arg1.target.y - coinIcon_mc.y) * 0.1));
_arg1.target.rotation = ((_arg1.target.x - coinIcon_mc.x) * 5);
} else {
_totalCoins = (_totalCoins + 1);
coins_txt.text = _totalCoins.toString();
_arg1.target.removeEventListener(Event.ENTER_FRAME, coinPickupAnimation);
removeChild(MovieClip(_arg1.target));
};
}
public function gameOverAnimationEnd(_arg1:Event):void{
addChild(MovieClip(_arg1.target));
if (_arg1.target.alpha < 2){
_arg1.target.alpha = (_arg1.target.alpha + 0.1);
} else {
gameOverBl = true;
_timer.stop();
_arg1.target.removeEventListener(Event.ENTER_FRAME, gameOverAnimationEnd);
_arg1.target.btnRestart.mouseChildren = false;
_arg1.target.btnRestart.buttonMode = true;
_arg1.target.btnRestart.addEventListener(MouseEvent.CLICK, restartLevel);
_totalScore = 0;
_levelArray = [];
};
}
public function moveShotsLayer(_arg1:Number):void{
_shotIndex = 0;
while (_shotIndex < _shotArray.length) {
_shotArray[_shotIndex].y = (_shotArray[_shotIndex].y + _arg1);
if ((((_shotArray[_shotIndex].y > stageArea_mc.y)) && ((_shotArray[_shotIndex].y < ((stageArea_mc.y + stageArea_mc.height) + _shotArray[_shotIndex].height))))){
if (_shotArray[_shotIndex].visible == false){
_shotArray[_shotIndex].visible = true;
_shotArray[_shotIndex].cacheAsBitmap = true;
};
} else {
_shotArray[_shotIndex].visible = false;
};
_shotIndex++;
};
}
public function shotBehaviour():void{
_shotIndex = 0;
while (_shotIndex < _shotArray.length) {
_shotArray[_shotIndex].x = (_shotArray[_shotIndex].x + (_shotArray[_shotIndex]._speed * _shotArray[_shotIndex]._direction));
if (_playerHurt == 0){
if (player_mc.hurtArea_mc.hitTestPoint(_shotArray[_shotIndex].x, _shotArray[_shotIndex].y)){
hurtPlayer();
if (_playerHealth <= 0){
gameOver();
};
explodeDust(_shotArray[_shotIndex], 30, -6, 6, 1, 1.5, -0.1, -0.2);
removeChild(_shotArray[_shotIndex]);
_shotArray.splice(_shotIndex, 1);
_hurtSnd.play();
};
};
_shotIndex++;
};
}
public function gameOver():void{
ghost_mc.removeEventListener(Event.ENTER_FRAME, ghostAnimation);
removeEventListener(Event.ENTER_FRAME, animation);
var _local1:MC_gameOverScreen = new MC_gameOverScreen();
addChild(_local1);
_local1.alpha = 0;
_local1.finalScore_mc.finalScore_txt.selectable = false;
_local1.finalScore_mc.finalScore_txt.text = _totalScore.toString();
_currentLevel = 0;
_levelHeight = 0;
_totalCoins = 0;
_totalHeight = 0;
_playerHurt = 0;
_playerHealthMax = 5;
_enemyChance = 0.18;
_enemyTypes = 0.1;
player_mc._fallSpeed = -15;
player_mc._direction = 1;
_local1.addEventListener(Event.ENTER_FRAME, gameOverAnimation);
}
public function checkCurrentPlatform(){
_platformIndex = 0;
while (_platformIndex < _platformArray.length) {
if (player_mc.y < _platformArray[_platformIndex].y){
if ((((player_mc.x > _platformArray[_platformIndex].x)) && ((player_mc.x < (_platformArray[_platformIndex].x + _platformArray[_platformIndex].width))))){
_currentPlatform = _platformArray[_platformIndex];
};
};
_platformIndex++;
};
}
public function createLevel(_arg1:int=20, _arg2:int=100, _arg3:int=300, _arg4:int=6){
var _local5:* = 0;
while (_local5 < _arg1) {
createPlatform((_arg3 - (_local5 * _arg2)));
_local5++;
};
_totalHeight = (_arg1 * _arg2);
BG_mc.gotoAndStop(Math.round((Math.random() * BG_mc.totalFrames)));
txtLevel.text = ("NÍVEL " + String(_currentLevel));
darkness_mc.alpha = 0;
nuvens.y = -(nuvens.height);
if (Math.random() > 0.5){
ghost_mc.x = -(ghost_mc.width);
};
ghost_mc.x = ((stageArea_mc.x + stageArea_mc.width) + ghost_mc.width);
if (Math.random() > 0.5){
ghost_mc.y = -(ghost_mc.height);
};
ghost_mc.y = ((stageArea_mc.y + stageArea_mc.height) + ghost_mc.height);
ghost_mc.removeEventListener(Event.ENTER_FRAME, ghostAnimation);
_playerHealth = _playerHealthMax;
health_mc.gotoAndStop(Math.round(((_playerHealth / _playerHealthMax) * health_mc.totalFrames)));
_playerHurt = 0;
_totalCoins = 0;
coins_txt.text = _totalCoins.toString();
_timeLeft = (45 + (5 * _currentLevel));
timeLeft_txt.text = _timeLeft.toString();
}
public function moveCheckPointsLayer(_arg1:Number):void{
_checkPointIndex = 0;
while (_checkPointIndex < _checkPointArray.length) {
_checkPointArray[_checkPointIndex].y = (_checkPointArray[_checkPointIndex].y + _arg1);
if ((((_checkPointArray[_checkPointIndex].y > stageArea_mc.y)) && ((_checkPointArray[_checkPointIndex].y < ((stageArea_mc.y + stageArea_mc.height) + _checkPointArray[_checkPointIndex].height))))){
if (_checkPointArray[_checkPointIndex].visible == false){
_checkPointArray[_checkPointIndex].visible = true;
_checkPointArray[_checkPointIndex].cacheAsBitmap = true;
};
} else {
_checkPointArray[_checkPointIndex].visible = false;
};
_checkPointIndex++;
};
}
public function moveDecalsLayer(_arg1:Number):void{
_decalIndex = 0;
while (_decalIndex < _decalArray.length) {
_decalArray[_decalIndex].y = (_decalArray[_decalIndex].y + _arg1);
if ((((_decalArray[_decalIndex].y > stageArea_mc.y)) && ((_decalArray[_decalIndex].y < ((stageArea_mc.y + stageArea_mc.height) + _decalArray[_decalIndex].height))))){
if (_decalArray[_decalIndex].visible == false){
_decalArray[_decalIndex].visible = true;
_decalArray[_decalIndex].cacheAsBitmap = true;
};
} else {
_decalArray[_decalIndex].visible = false;
};
_decalIndex++;
};
}
public function hurtPlayer(_arg1:int=1, _arg2:int=100):void{
_playerHealth = (_playerHealth - _arg1);
health_mc.gotoAndStop(Math.round(((_playerHealth / _playerHealthMax) * health_mc.totalFrames)));
player_mc.head_mc.gotoAndStop("hurt");
_playerHurt = _arg2;
}
}
}//package pula_pula_fla
Section 2
//MC_checkPoint (MC_checkPoint)
package {
import flash.display.*;
public dynamic class MC_checkPoint extends MovieClip {
public function MC_checkPoint(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package
Section 3
//MC_coin (MC_coin)
package {
import flash.display.*;
public dynamic class MC_coin extends MovieClip {
}
}//package
Section 4
//MC_decal (MC_decal)
package {
import flash.display.*;
public dynamic class MC_decal extends MovieClip {
}
}//package
Section 5
//MC_dust (MC_dust)
package {
import flash.display.*;
public dynamic class MC_dust extends MovieClip {
}
}//package
Section 6
//MC_enemy (MC_enemy)
package {
import flash.display.*;
public dynamic class MC_enemy extends MovieClip {
public var enemy_mc:MovieClip;
}
}//package
Section 7
//MC_gameOverScreen (MC_gameOverScreen)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MC_gameOverScreen extends MovieClip {
public var score_txt:TextField;
public var timeLeft_txt:TextField;
public var finalScore_mc:MovieClip;
public var btnRestart:MovieClip;
}
}//package
Section 8
//MC_gameStartScreen (MC_gameStartScreen)
package {
import flash.display.*;
public dynamic class MC_gameStartScreen extends MovieClip {
public var tapume:MovieClip;
public var btnJogar:MovieClip;
public var btnHelp:MovieClip;
}
}//package
Section 9
//MC_platform (MC_platform)
package {
import flash.display.*;
public dynamic class MC_platform extends MovieClip {
public var firstPlataform2:MovieClip;
public var grass_mc:MovieClip;
}
}//package
Section 10
//MC_readyGo (MC_readyGo)
package {
import flash.display.*;
public dynamic class MC_readyGo extends MovieClip {
}
}//package
Section 11
//MC_scoreScreen (MC_scoreScreen)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MC_scoreScreen extends MovieClip {
public var score_txt:TextField;
public var coins_txt:TextField;
public var nextStageBt:SimpleButton;
public var timeLeft_txt:TextField;
public var totalScore_txt:TextField;
}
}//package
Section 12
//MC_shot (MC_shot)
package {
import flash.display.*;
public dynamic class MC_shot extends MovieClip {
}
}//package
Section 13
//MC_star (MC_star)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MC_star extends MovieClip {
public var currentLevel_txt:TextField;
}
}//package
Section 14
//MC_twinkle (MC_twinkle)
package {
import flash.display.*;
public dynamic class MC_twinkle extends MovieClip {
}
}//package
Section 15
//SND_bounce (SND_bounce)
package {
import flash.media.*;
public dynamic class SND_bounce extends Sound {
}
}//package
Section 16
//SND_flag (SND_flag)
package {
import flash.media.*;
public dynamic class SND_flag extends Sound {
}
}//package
Section 17
//SND_hit (SND_hit)
package {
import flash.media.*;
public dynamic class SND_hit extends Sound {
}
}//package
Section 18
//SND_hurt (SND_hurt)
package {
import flash.media.*;
public dynamic class SND_hurt extends Sound {
}
}//package
Section 19
//SND_lose (SND_lose)
package {
import flash.media.*;
public dynamic class SND_lose extends Sound {
}
}//package
Section 20
//SND_pickup1 (SND_pickup1)
package {
import flash.media.*;
public dynamic class SND_pickup1 extends Sound {
}
}//package
Section 21
//SND_pickup2 (SND_pickup2)
package {
import flash.media.*;
public dynamic class SND_pickup2 extends Sound {
}
}//package
Section 22
//SND_pickup3 (SND_pickup3)
package {
import flash.media.*;
public dynamic class SND_pickup3 extends Sound {
}
}//package
Section 23
//SND_pop (SND_pop)
package {
import flash.media.*;
public dynamic class SND_pop extends Sound {
}
}//package
Section 24
//SND_win (SND_win)
package {
import flash.media.*;
public dynamic class SND_win extends Sound {
}
}//package
Section 25
//TelaJogar (TelaJogar)
package {
import flash.display.*;
public dynamic class TelaJogar extends MovieClip {
public var btnClose:MovieClip;
}
}//package