Home > other >  Consult a great god this code is what mean
Consult a great god this code is what mean

Time:09-25

Stop ();


StartGame_btn. AddEventListener (MouseEvent. CLICK startGameFun);
HelpGame_btn. AddEventListener (MouseEvent. CLICK helpGameFun);

The function startGameFun (e: MouseEvent)
{
Play ();
}
The function helpGameFun (e: MouseEvent)
{
//TweenLite. To (helpgame_mc, 1.0, {x: stage. StageWidth/2, y: stage. StageHeight/2});
Helpgame_mc. X=stage. StageWidth/2;
Helpgame_mc. Y=stage. StageHeight/2;
Helpgame_mc. Play ();
}



Stop ();

Var coneArray: Array=new Array (20);
Var boneArray: Array=new Array (2);
Var its ehrs: Hero=new Hero ();

For (var I: int=new int (0); I {
ConeArray [I]=new Cone ();
}
for(i=0; I {
BoneArray [I]=new ipads ();
}

Var coneMoveTimeArray: Array=new Array (coneArray. Length);
Var boneMoveTimeArray: Array=new Array (boneArray. Length);

SetGame ();
The function setGame ()
{
Time_tex. Text="0";
Score_tex. Text="0";

For (var I: int=new int (0); I {
ConeArray [I]. X=Math. Abs (Math) random ()) * stage in stageWidth;
ConeArray [I] y=- Math. Abs (Math) random () * stage in stageHeight);

ConeArray [I]. ScaleX=coneArray [I] scaleY=math.h abs (Math) random () * 0.5) + 0.3.

ConeMoveTimeArray [I]=new int (Math. Abs (Math) random () * 5) + 1);
}
for(i=0; I {
BoneArray [I]. X=Math. Abs (Math) random ()) * stage in stageWidth;
BoneArray [I] y=- Math. Abs (Math) random () * stage in stageHeight);

BoneArray [I]. ScaleX=boneArray [I] scaleY=math.h abs (Math) random () * 0.5) + 0.3.

BoneMoveTimeArray [I]=new int (Math. Abs (Math) random () * 5) + 1);
}



Its ehrs. X=stage. StageWidth/2;
Its ehrs. Y=stage. StageHeight - its ehrs. Height;

AddChildAt (its ehrs, 5);
for(i=0; I {
AddChildAt (coneArray [I] 1);
}
for(i=0; I {
AddChildAt (boneArray [I] 1);
}
}

//=========================================================================================

Var time: the Timer=new Timer (100);
Time. The addEventListener (" timer ", RePain);
Time. The start ();

The function RePain (e: TimerEvent)
{

for(var i=0; I {
ConeArray [I] + y=0.5 * 9.8 * (coneMoveTimeArray [I] + +);


If (coneArray [I] y>=stage. StageHeight)
{
ConeArray [I]. X=Math. Abs (Math) random ()) * stage in stageWidth;
ConeArray [I] y=- Math. Abs (Math) random () * stage in stageHeight);
ConeArray [I]. ScaleX=coneArray [I] scaleY=math.h abs (Math) random () * 0.5) + 0.3.

ConeMoveTimeArray [I]=new int (Math. Abs (Math) random () * 5) + 1);
}


If (its ehrs. HitTestObject (coneArray [I]))
{
ConeArray [I]. X=Math. Abs (Math) random ()) * stage in stageWidth;
ConeArray [I] y=- Math. Abs (Math) random () * stage in stageHeight);
ConeArray [I]. ScaleX=coneArray [I] scaleY=math.h abs (Math) random () * 0.5) + 0.3.

ConeMoveTimeArray [I]=new int (Math. Abs (Math) random () * 5) + 1);

Score_tex. Text=(Number (score_tex. Text) + 5). The toString ();
}
}
for(i=0; I {
BoneArray [I] + y=0.5 * 9.8 * (boneMoveTimeArray [I] + +);


If (boneArray [I] y>=stage. StageHeight)
{
BoneArray [I]. X=Math. Abs (Math) random ()) * stage in stageWidth;
BoneArray [I] y=- Math. Abs (Math) random () * stage in stageHeight);
BoneArray [I]. ScaleX=boneArray [I] scaleY=math.h abs (Math) random () * 0.5) + 0.3.

BoneMoveTimeArray [I]=new int (Math. Abs (Math) random () * 5) + 1);
}


If (its ehrs. HitTestObject (boneArray [I]))
{
GameOver ();
}
}

Time_tex. Text=(Number (time_tex. Text) + 1). The toString ();
}
//==================================================

Stage. The addEventListener (KeyboardEvent KEY_DOWN, keyboardFun);
Stage. The addEventListener (KeyboardEvent KEY_DOWN, keyboardFun);

The function keyboardFun (e: KeyboardEvent)
{

If (e.k eyCode==37)
{
Its ehrs. X=10;
}
Else if (e.k eyCode==39)
{
Its ehrs. X +=10;
}
}

//================================================================
The function GameOver ()
{

Time. Stop ();

Its ehrs. Alpha=0.2;
for(var i=0; I {
ConeArray [I]. Alpha=0.8;
}
for(i=0; I {
//removeChild (boneArray [I]);
BoneArray [I]. Alpha=0.8;
}
Returnmenu_btn. + y=stage. StageWidth/2-100;
Again_btn. + y=stage. StageWidth/2-100;
}
//==========================================================
Returnmenu_btn. AddEventListener (MouseEvent. CLICK returnmenuFun);
Again_btn. AddEventListener (MouseEvent. CLICK againFun);

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related