Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import Box2D.Collision.Shapes.*;
- import Box2D.Common.Math.*;
- import Box2D.Dynamics.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.media.*;
- import flash.text.*;
- import mochi.as3.*;
- public class kickgame extends Sprite
- {
- private var world:b2World;
- private var worldScale:Number = 30;
- private var ballVector:Object;
- private var textVector:Object;
- private var floorVector:Object;
- private var ballSize:uint = 60;
- private var shad:shade;
- private var socBall:soccerBall;
- private var grassFloor:grass;
- private var trackArrow:tArrow;
- private var theFont:Font;
- private var comboCount:int = 0;
- private var myFormat:TextFormat;
- private var theGlow:GlowFilter;
- private var sVal:uint = 0;
- private var hVal:uint = 20;
- private var maxScore:uint;
- private var menuB:menuButton;
- private var menuButton2:menuB2;
- private var menuButton3:menuB3;
- private var menuButton4:Button4;
- private var menuP:menuPanel;
- private var theBall:b2Body;
- private var missHit:Boolean;
- private var theTitle:titleWords;
- private var playB:playText;
- private var rectangle:Shape;
- private var ridTitle:Boolean = false;
- private var firstKick:Boolean = false;
- private var kSound:kickSound;
- private var kSound2:kickSound2;
- private var gSound:grassSound;
- private var gSound1:grassSound1;
- private var gSound2:grassSound2;
- private var sChan:SoundChannel;
- private var wSound:wooshSound;
- private var sTrans:Object;
- private var hit:pow;
- private var miss:pow2;
- private var playSound:Boolean = true;
- private var lBoard:MovieClip;
- private var mClip:MovieClip;
- private var ticks:uint;
- private var remindText:TextField;
- private var hScore:Number = 0;
- private var maxhScore:Number;
- private var aSound:ambient;
- private var aChan:SoundChannel;
- private var aTrans:Object;
- public function kickgame() : void
- {
- var _loc_3:* = null;
- this.ballVector = new Vector.<b2Body>;
- this.textVector = new Vector.<TextField>;
- this.floorVector = new Vector.<b2Body>;
- this.shad = new shade();
- this.theFont = new bubble();
- this.kSound = new kickSound();
- this.kSound2 = new kickSound2();
- this.gSound = new grassSound();
- this.gSound1 = new grassSound1();
- this.gSound2 = new grassSound2();
- this.sChan = new SoundChannel();
- this.wSound = new wooshSound();
- this.sTrans = new SoundTransform();
- this.hit = new pow();
- this.miss = new pow2();
- this.lBoard = new MovieClip();
- this.mClip = new MovieClip();
- this.aSound = new ambient();
- this.aTrans = new SoundTransform();
- stage.addChild(this.lBoard);
- stage.addChild(this.mClip);
- MochiAd.showPreGameAd({clip:this.mClip, id:"bfe4665090168162", res:"640x480"});
- MochiServices.connect("bfe4665090168162", this.lBoard);
- this.world = new b2World(new b2Vec2(0, 9.81), true);
- this.world.SetContactListener(new customContact());
- this.trackArrow = new tArrow();
- addChild(this.trackArrow);
- this.trackArrow.x = 0;
- this.trackArrow.y = 0;
- this.trackArrow.visible = false;
- this.menuB = new menuButton();
- this.menuB.y = 0 + this.menuB.height / 2;
- this.menuB.x = 640 - this.menuB.width / 2;
- addChild(this.menuB);
- this.myFormat = new TextFormat();
- this.myFormat.size = 18;
- this.myFormat.align = TextFormatAlign.LEFT;
- this.myFormat.font = this.theFont.fontName;
- var _loc_1:* = new TextField();
- _loc_1.defaultTextFormat = this.myFormat;
- _loc_1.embedFonts = true;
- addChild(_loc_1);
- _loc_1.textColor = 16777215;
- _loc_1.border = false;
- _loc_1.wordWrap = false;
- _loc_1.selectable = false;
- _loc_1.width = 10;
- _loc_1.autoSize = "right";
- _loc_1.x = 640 - _loc_1.width;
- _loc_1.y = this.menuB.height;
- _loc_1.text = "MAX COMBO: " + this.maxScore;
- this.textVector.push(_loc_1);
- this.theGlow = new GlowFilter();
- this.theGlow.inner = false;
- this.theGlow.color = 0;
- this.theGlow.alpha = 1;
- this.theGlow.blurX = 4;
- this.theGlow.blurY = 4;
- this.theGlow.strength = 15;
- _loc_1.filters = [this.theGlow];
- _loc_1 = new TextField();
- _loc_1.defaultTextFormat = this.myFormat;
- _loc_1.embedFonts = true;
- addChild(_loc_1);
- _loc_1.textColor = 16777215;
- _loc_1.border = false;
- _loc_1.wordWrap = false;
- _loc_1.selectable = false;
- _loc_1.width = 10;
- _loc_1.autoSize = "right";
- _loc_1.x = 640 - _loc_1.width;
- _loc_1.y = this.hVal + this.menuB.height;
- _loc_1.text = this.comboCount.toString();
- this.theGlow = new GlowFilter();
- this.theGlow.inner = false;
- this.theGlow.color = 0;
- this.theGlow.alpha = 1;
- this.theGlow.blurX = 4;
- this.theGlow.blurY = 4;
- this.theGlow.strength = 15;
- _loc_1.filters = [this.theGlow];
- this.textVector.push(_loc_1);
- _loc_1 = new TextField();
- _loc_1.defaultTextFormat = this.myFormat;
- _loc_1.embedFonts = true;
- addChild(_loc_1);
- _loc_1.textColor = 16777215;
- _loc_1.border = false;
- _loc_1.wordWrap = false;
- _loc_1.selectable = false;
- _loc_1.width = 10;
- _loc_1.autoSize = "right";
- _loc_1.height = 50;
- _loc_1.x = 640 - _loc_1.width - this.textVector[1].width;
- _loc_1.y = this.hVal + this.menuB.height;
- _loc_1.text = "COMBO:";
- this.theGlow = new GlowFilter();
- this.theGlow.inner = false;
- this.theGlow.color = 0;
- this.theGlow.alpha = 1;
- this.theGlow.blurX = 4;
- this.theGlow.blurY = 4;
- this.theGlow.strength = 15;
- _loc_1.filters = [this.theGlow];
- this.textVector.push(_loc_1);
- this.remindText = new TextField();
- this.remindText.defaultTextFormat = this.myFormat;
- this.remindText.embedFonts = true;
- addChild(this.remindText);
- this.remindText.textColor = 16777215;
- this.remindText.border = false;
- this.remindText.wordWrap = false;
- this.remindText.selectable = false;
- this.remindText.width = 200;
- this.remindText.height = 50;
- this.remindText.x = 640 / 2 + 40;
- this.remindText.y = -40;
- this.remindText.text = "SUBMIT SCORE >";
- this.remindText.alpha = 0.8;
- this.theGlow = new GlowFilter();
- this.theGlow.inner = false;
- this.theGlow.color = 0;
- this.theGlow.alpha = 0.8;
- this.theGlow.blurX = 4;
- this.theGlow.blurY = 4;
- this.theGlow.strength = 15;
- this.remindText.filters = [this.theGlow];
- this.textVector.push(this.remindText);
- var _loc_2:* = new b2BodyDef();
- _loc_2.position.Set(320 / this.worldScale, 100 / this.worldScale);
- _loc_2.type = b2Body.b2_dynamicBody;
- _loc_3 = new b2CircleShape(this.ballSize / this.worldScale);
- var _loc_4:* = new b2FixtureDef();
- _loc_4.shape = _loc_3;
- _loc_4.density = 1;
- _loc_4.restitution = 0.6;
- _loc_4.friction = 0.1;
- this.theBall = this.world.CreateBody(_loc_2);
- this.socBall = new soccerBall();
- this.theBall.SetUserData(this.socBall);
- this.theBall.CreateFixture(_loc_4);
- this.ballVector.push(this.theBall);
- this.theBall.GetUserData().x = this.theBall.GetPosition().x * 30;
- this.theBall.GetUserData().y = this.theBall.GetPosition().y * 30;
- this.theBall.GetUserData().height = this.ballSize * 2;
- this.theBall.GetUserData().width = this.ballSize * 2;
- addChild(this.theBall.GetUserData());
- _loc_2.position.Set(320 / this.worldScale, 470 / this.worldScale);
- _loc_2.type = b2Body.b2_staticBody;
- var _loc_5:* = new b2PolygonShape();
- _loc_5.SetAsBox(320 / this.worldScale, 10 / this.worldScale);
- _loc_4.shape = _loc_5;
- var _loc_6:* = this.world.CreateBody(_loc_2);
- _loc_6.CreateFixture(_loc_4);
- _loc_6.SetUserData("floor");
- _loc_2.position.Set(-10 / this.worldScale, -4600 / this.worldScale);
- _loc_2.type = b2Body.b2_staticBody;
- _loc_5.SetAsBox(10 / this.worldScale, 5080 / this.worldScale);
- _loc_4.shape = _loc_5;
- _loc_6 = this.world.CreateBody(_loc_2);
- _loc_6.CreateFixture(_loc_4);
- _loc_2.position.Set(650 / this.worldScale, -4600 / this.worldScale);
- _loc_2.type = b2Body.b2_staticBody;
- _loc_5.SetAsBox(10 / this.worldScale, 5080 / this.worldScale);
- _loc_4.shape = _loc_5;
- _loc_6 = this.world.CreateBody(_loc_2);
- _loc_6.CreateFixture(_loc_4);
- addChild(this.shad);
- this.shad.x = 320;
- this.shad.y = 100;
- this.shad.height = this.ballSize * 2;
- this.shad.width = this.ballSize * 2;
- this.shad.alpha = 0.5;
- this.hit.x = -100;
- this.hit.scaleX = 0.5;
- this.hit.scaleY = 0.5;
- this.miss.x = -100;
- this.miss.scaleX = 0.5;
- this.miss.scaleY = 0.5;
- this.debugDraw();
- this.grassRender();
- this.titleBuilder();
- return;
- }// end function
- private function titleBuilder() : void
- {
- var _loc_1:* = undefined;
- this.rectangle = new Shape();
- this.rectangle.graphics.beginFill(16777215, 0.4);
- this.rectangle.graphics.drawRect(0, 0, 640, 480);
- this.rectangle.graphics.endFill();
- addChild(this.rectangle);
- this.theTitle = new titleWords();
- addChild(this.theTitle);
- this.theTitle.x = 640 / 2;
- this.theTitle.y = 480 / 2;
- this.playB = new playText();
- addChild(this.playB);
- this.playB.scaleY = 0.5;
- this.playB.scaleX = 0.5;
- this.playB.x = 640 / 2;
- this.playB.y = 480 * 3 / 4;
- this.playB.alpha = 0.8;
- for each (_loc_1 in this.textVector)
- {
- _loc_1.visible = false;
- }
- this.menuB.visible = false;
- addEventListener(Event.ENTER_FRAME, this.titleManager);
- addEventListener(MouseEvent.CLICK, this.playGame);
- return;
- }// end function
- private function playGame(event:MouseEvent) : void
- {
- if (mouseX >= this.playB.x - this.playB.width / 2 && mouseX <= this.playB.x + this.playB.width / 2 && mouseY >= this.playB.y - this.playB.height / 2 && mouseY <= this.playB.y + this.playB.height / 2)
- {
- this.ridTitle = true;
- }
- return;
- }// end function
- private function titleManager(event:Event) : void
- {
- if (mouseX >= this.playB.x - this.playB.width / 2 && mouseX <= this.playB.x + this.playB.width / 2 && mouseY >= this.playB.y - this.playB.height / 2 && mouseY <= this.playB.y + this.playB.height / 2)
- {
- this.playB.gotoAndPlay(2);
- }
- else
- {
- this.playB.gotoAndPlay(1);
- }
- if (this.ridTitle == true)
- {
- this.rectangle.alpha = this.rectangle.alpha - 0.01;
- this.playB.alpha = this.playB.alpha - 0.01;
- this.theTitle.alpha = this.theTitle.alpha - 0.01;
- addEventListener(Event.ENTER_FRAME, this.updateWorld);
- if (this.rectangle.alpha <= 0 && this.playB.alpha <= 0 && this.theTitle.alpha <= 0)
- {
- removeChild(this.playB);
- removeChild(this.theTitle);
- removeChild(this.rectangle);
- this.gamePreparer();
- }
- }
- return;
- }// end function
- private function gamePreparer() : void
- {
- var _loc_1:* = undefined;
- removeEventListener(Event.ENTER_FRAME, this.titleManager);
- removeEventListener(MouseEvent.CLICK, this.playGame);
- addEventListener(MouseEvent.MOUSE_DOWN, this.kickball);
- this.menuB.addEventListener(MouseEvent.CLICK, this.onClickHandler);
- this.menuB.visible = true;
- for each (_loc_1 in this.textVector)
- {
- _loc_1.visible = true;
- }
- this.tipBuilder();
- this.playAmbient();
- return;
- }// end function
- private function playAmbient() : void
- {
- this.aChan = this.aSound.play();
- this.aChan.soundTransform = this.aTrans;
- this.aChan.addEventListener(Event.SOUND_COMPLETE, this.resumeAmbient);
- return;
- }// end function
- private function resumeAmbient(event:Event) : void
- {
- SoundChannel(event.target).removeEventListener(event.type, this.resumeAmbient);
- this.playAmbient();
- return;
- }// end function
- private function tipBuilder() : void
- {
- this.myFormat = new TextFormat();
- this.myFormat.size = 18;
- this.myFormat.align = TextFormatAlign.CENTER;
- this.myFormat.font = this.theFont.fontName;
- var _loc_1:* = new TextField();
- _loc_1.defaultTextFormat = this.myFormat;
- _loc_1.embedFonts = true;
- addChild(_loc_1);
- _loc_1.textColor = 16777215;
- _loc_1.border = false;
- _loc_1.wordWrap = false;
- _loc_1.selectable = false;
- _loc_1.width = 300;
- _loc_1.text = "Clicking towards the edge of the" + "\n ball increases kick force";
- _loc_1.x = 640 / 2 - _loc_1.width / 2;
- _loc_1.y = 260;
- _loc_1.alpha = 0.5;
- this.textVector.push(_loc_1);
- this.theGlow = new GlowFilter();
- this.theGlow.inner = false;
- this.theGlow.color = 0;
- this.theGlow.alpha = 1;
- this.theGlow.blurX = 4;
- this.theGlow.blurY = 4;
- this.theGlow.strength = 15;
- this.theGlow.alpha = 0;
- _loc_1.filters = [this.theGlow];
- addEventListener(Event.ENTER_FRAME, this.tipManager);
- return;
- }// end function
- private function tipManager(event:Event) : void
- {
- if (this.firstKick == true)
- {
- this.textVector[4].alpha = this.textVector[4].alpha - 0.001;
- }
- if (this.textVector[4].alpha <= 0)
- {
- removeChild(this.textVector[4]);
- this.textVector.splice(3, 1);
- removeEventListener(Event.ENTER_FRAME, this.tipManager);
- }
- return;
- }// end function
- private function kickball(event:MouseEvent) : void
- {
- var _loc_2:* = mouseX / this.worldScale;
- var _loc_3:* = mouseY / this.worldScale;
- if (mouseX > this.menuB.x + this.menuB.width / 2 || mouseX < this.menuB.x - this.menuB.width / 2 || mouseY > this.menuB.y + this.menuB.height / 2 || mouseY < this.menuB.y - this.menuB.height / 2)
- {
- this.missHit = true;
- }
- else
- {
- this.missHit = false;
- }
- this.world.QueryPoint(this.queryCallBack, new b2Vec2(_loc_2, _loc_3));
- return;
- }// end function
- private function negativeHit() : void
- {
- if (this.comboCount > this.maxScore)
- {
- this.maxScore = this.comboCount;
- this.maxhScore = this.hScore;
- this.textVector[0].text = "MAX COMBO: " + this.maxScore;
- }
- if (this.comboCount >= 10)
- {
- this.scoreReminder();
- }
- this.comboCount = 0;
- this.hScore = 0;
- this.textVector[1].text = this.comboCount.toString();
- this.textVector[1].scaleY = 1;
- this.textVector[1].scaleX = 1;
- this.textVector[1].defaultTextFormat = this.myFormat;
- this.textVector[1].y = this.hVal + this.menuB.height;
- this.textVector[1].x = 640 - this.textVector[1].width;
- this.sVal = 0;
- this.textVector[2].x = 640 - this.textVector[1].width - this.textVector[2].width;
- return;
- }// end function
- private function scoreReminder() : void
- {
- this.ticks = 0;
- addEventListener(Event.ENTER_FRAME, this.remindManager);
- return;
- }// end function
- private function remindManager(event:Event) : void
- {
- var _loc_2:* = this;
- var _loc_3:* = this.ticks + 1;
- _loc_2.ticks = _loc_3;
- if (this.ticks < 80)
- {
- this.remindText.y = this.remindText.y + 0.5;
- }
- if (this.ticks > 160)
- {
- this.remindText.y = this.remindText.y - 0.5;
- }
- if (this.ticks > 236)
- {
- this.remindText.y = -40;
- removeEventListener(Event.ENTER_FRAME, this.remindManager);
- }
- return;
- }// end function
- private function gSoundSelector() : void
- {
- var _loc_1:* = NaN;
- _loc_1 = Math.random();
- this.sTrans.volume = 1.9;
- if (_loc_1 <= 0.5)
- {
- this.sChan = this.gSound1.play(500);
- }
- else
- {
- this.sChan = this.gSound2.play(400);
- }
- this.sChan.soundTransform = this.sTrans;
- return;
- }// end function
- private function kSoundSelector() : void
- {
- var _loc_1:* = NaN;
- _loc_1 = Math.random();
- this.sTrans.volume = 0.75;
- if (_loc_1 <= 0.5)
- {
- this.sChan = this.kSound.play(20);
- }
- else
- {
- this.sChan = this.kSound2.play(20);
- }
- this.sChan.soundTransform = this.sTrans;
- return;
- }// end function
- private function positiveHit() : void
- {
- var _loc_1:* = this;
- var _loc_2:* = this.comboCount + 1;
- _loc_1.comboCount = _loc_2;
- this.hScore = this.hScore + 0.5;
- var _loc_1:* = this;
- var _loc_2:* = this.sVal + 1;
- _loc_1.sVal = _loc_2;
- this.textVector[1].text = this.comboCount.toString();
- this.textVector[1].scaleY = 1 + 1 / 18 * this.sVal;
- this.textVector[1].scaleX = 1 + 1 / 18 * this.sVal;
- this.textVector[1].defaultTextFormat = this.myFormat;
- this.textVector[1].y = this.textVector[1].y - 0.3;
- this.textVector[1].x = 640 - this.textVector[1].width;
- this.textVector[2].x = 640 - this.textVector[1].width - this.textVector[2].width;
- return;
- }// end function
- private function queryCallBack(param1:b2Fixture) : Boolean
- {
- var _loc_2:* = param1.GetBody();
- if (_loc_2 == this.theBall)
- {
- this.missHit = false;
- this.firstKick = true;
- }
- else
- {
- this.missHit = true;
- var _loc_3:* = this;
- var _loc_4:* = this.comboCount - 1;
- _loc_3.comboCount = _loc_4;
- this.hScore = this.hScore - 0.5;
- }
- this.kickImpulse(_loc_2);
- return false;
- }// end function
- private function kickImpulse(param1:b2Body) : void
- {
- var _loc_5:* = NaN;
- var _loc_6:* = NaN;
- var _loc_7:* = null;
- var _loc_2:* = param1.GetWorldCenter();
- var _loc_3:* = mouseX / this.worldScale;
- var _loc_4:* = mouseY / this.worldScale;
- _loc_5 = (_loc_2.x - _loc_3) * 240;
- _loc_6 = (_loc_2.y - _loc_4) * 240;
- _loc_7 = new b2Vec2(_loc_5, _loc_6);
- if (param1.GetLinearVelocity().y > 0)
- {
- param1.SetLinearVelocity(new b2Vec2(param1.GetLinearVelocity().x, 1));
- }
- param1.ApplyImpulse(_loc_7, _loc_2);
- this.positiveHit();
- if (param1 == this.theBall)
- {
- if (this.playSound == true)
- {
- this.kSoundSelector();
- }
- this.hit.gotoAndPlay(1);
- this.hit.x = mouseX;
- this.hit.y = mouseY;
- }
- return;
- }// end function
- private function debugDraw() : void
- {
- return;
- }// end function
- private function updateWorld(event:Event) : void
- {
- var _loc_6:* = undefined;
- var _loc_2:* = 1 / 60;
- var _loc_3:* = 10;
- var _loc_4:* = 10;
- this.world.Step(_loc_2, _loc_3, _loc_4);
- this.world.ClearForces();
- this.world.DrawDebugData();
- var _loc_5:* = this.world.GetBodyList();
- while (_loc_5)
- {
- if (_loc_5.GetUserData() == this.socBall)
- {
- _loc_5.GetUserData().x = _loc_5.GetPosition().x * 30;
- _loc_5.GetUserData().y = _loc_5.GetPosition().y * 30;
- _loc_5.GetUserData().rotation = _loc_5.GetAngle() * 180 / Math.PI;
- }
- if (_loc_5.GetUserData() == "hit")
- {
- _loc_5.SetUserData("floor");
- this.negativeHit();
- if (this.playSound == true)
- {
- this.gSoundSelector();
- }
- }
- if (this.missHit == true)
- {
- this.negativeHit();
- this.missHit = false;
- this.miss.gotoAndPlay(1);
- this.miss.x = mouseX;
- this.miss.y = mouseY;
- this.sTrans.volume = 0.8;
- if (this.playSound == true)
- {
- this.sChan = this.wSound.play();
- }
- this.sChan.soundTransform = this.sTrans;
- }
- _loc_5 = _loc_5.GetNext();
- }
- for each (_loc_6 in this.ballVector)
- {
- this.shad.x = _loc_6.GetPosition().x * 30;
- this.shad.y = _loc_6.GetPosition().y * 30;
- this.shad.height = this.ballSize * 2;
- this.shad.width = this.ballSize * 2;
- this.trackArrow.x = _loc_6.GetPosition().x * 30;
- if (_loc_6.GetPosition().y * 30 < -60)
- {
- this.trackArrow.visible = true;
- continue;
- }
- this.trackArrow.visible = false;
- }
- return;
- }// end function
- private function grassRender() : void
- {
- this.grassFloor = new grass();
- addChild(this.grassFloor);
- this.grassFloor.x = 0;
- this.grassFloor.y = 450;
- this.grassFloor = new grass();
- addChild(this.grassFloor);
- this.grassFloor.x = this.grassFloor.width - 20;
- this.grassFloor.y = 450;
- addChild(this.hit);
- addChild(this.miss);
- return;
- }// end function
- private function onRollOverHandler(event:MouseEvent) : void
- {
- this.menuB.gotoAndPlay(2);
- return;
- }// end function
- private function onRollOutHandler(event:MouseEvent) : void
- {
- this.menuB.gotoAndPlay(1);
- return;
- }// end function
- private function onClickHandler(event:MouseEvent) : void
- {
- this.menuBuilder();
- return;
- }// end function
- private function menuBuilder() : void
- {
- this.menuP = new menuPanel();
- this.menuP.x = 640 / 2;
- this.menuP.y = 480 / 2;
- addChild(this.menuP);
- this.menuButton2 = new menuB2();
- this.menuButton2.x = 640 / 2;
- this.menuButton2.y = 480 / 2 + 20;
- addChild(this.menuButton2);
- this.menuButton2.addEventListener(MouseEvent.CLICK, this.menuClick(this.menuButton2));
- if (this.playSound == false)
- {
- this.menuButton2.gotoAndPlay(2);
- }
- this.menuButton3 = new menuB3();
- this.menuButton3.x = 640 / 2;
- this.menuButton3.y = 480 / 2 + this.menuButton3.height + 25;
- addChild(this.menuButton3);
- this.menuButton3.addEventListener(MouseEvent.CLICK, this.menuClick(this.menuButton3));
- this.menuButton4 = new Button4();
- this.menuButton4.scaleY = 1.2;
- this.menuButton4.scaleX = 1.2;
- this.menuButton4.x = 640 / 2;
- this.menuButton4.y = 480 / 2 - 15;
- addChild(this.menuButton4);
- this.menuButton4.addEventListener(MouseEvent.CLICK, this.menuClick(this.menuButton4));
- removeEventListener(Event.ENTER_FRAME, this.updateWorld);
- removeEventListener(MouseEvent.MOUSE_DOWN, this.kickball);
- this.menuB.removeEventListener(MouseEvent.CLICK, this.onClickHandler);
- return;
- }// end function
- private function menuClick(param1:Object) : Function
- {
- var bPressed:* = param1;
- var ret:* = function (event:MouseEvent) : void
- {
- var o:Object;
- var boardID:String;
- var e:* = event;
- if (bPressed == menuButton3)
- {
- resumeGame();
- }
- if (bPressed == menuButton2)
- {
- if (playSound == true)
- {
- playSound = false;
- aTrans.volume = 0;
- aChan.soundTransform = aTrans;
- menuButton2.gotoAndPlay(2);
- }
- else
- {
- playSound = true;
- aTrans.volume = 1;
- aChan.soundTransform = aTrans;
- menuButton2.gotoAndPlay(1);
- }
- }
- if (bPressed == menuButton4)
- {
- o;
- boardID = o.f(0, "");
- MochiScores.showLeaderboard({boardID:boardID, score:maxhScore * 2});
- }
- return;
- }// end function
- ;
- return ret;
- }// end function
- private function resumeGame() : void
- {
- removeChild(this.menuP);
- this.menuB.addEventListener(MouseEvent.CLICK, this.onClickHandler);
- this.menuButton2.removeEventListener(MouseEvent.CLICK, this.menuClick(this.menuButton2));
- this.menuButton3.removeEventListener(MouseEvent.CLICK, this.menuClick(this.menuButton3));
- this.menuButton4.removeEventListener(MouseEvent.CLICK, this.menuClick(this.menuButton4));
- removeChild(this.menuButton4);
- removeChild(this.menuButton2);
- removeChild(this.menuButton3);
- addEventListener(Event.ENTER_FRAME, this.updateWorld);
- addEventListener(MouseEvent.MOUSE_DOWN, this.kickball);
- return;
- }// end function
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement