LethalxTreat

jew

May 12 2008, 12:44 PM

setup=function()
{
            firing=false;
            fireRate=5;
            enemyTime=0;
            enemyRate=30;
            score=0
            score_txt.text=score;
            counter=20;
            counter_txt.text=counter;
            ship.onMouseDown=function()
            {
                        firing=true;
                        repeatTime=0;
            }
            ship.onMouseUp=function()
            {
                        firing=false;
            }
            ship.onEnterFrame=function()
            {
                        this.destx=_xmouse;
                        var diffx=(this.destx-this._x)
                        this._x += diffx * 1;
                       
                        if (firing && repeatTime==0)
                        {
                                    createProjectile("bullet",this._x,this._y - 10,0, -40);
                        }
                        repeatTime ++;
                        repeatTime %= fireRate;
                       
                        if(enemyTime == 0)
                        {
                                    var sx=Math.random() * 100 + 80;
                                    createEnemy("bob",sx, -30);
                                    createEnemy("bob", 200, -30);
                                    createEnemy("bob", 400 - sx, -30);
                        }
                        enemyTime ++;
                        enemyTime %= 30;
            }
            doCounter=function()
            {
                        counter--;
                        counter_txt.text = counter;
                       
                        if (counter == 0)
                        {
                                    delete ship.onEnterFrame;
                                    delete bgscroller.onEnterFrame;
                                    enemyLayer.removeMovieClip();
                                    projectileLayer.removeMovieClip();
                                    startButton._visible = true;
                                    clearInterval(countID);
                        }
            }
           
            countID = setInterval(doCounter, 1000);
            _root.createEmptyMovieClip("projectileLayer", 99);
            projectileCount=0;
            _root.createEmptyMovieClip("enemyLayer", 98);
            enemyCount=0;
           
            ship.swapDepths(100);
            ship.gotoAndStop(1);
            bgscroller.onEnterFrame = function()
            {
                        if (this._y >= 500)
                        {
                                    this._y = 0;
                        }
                        this._y+=5;
            }
}
 
createProjectile = function(type,x,y,dx,dy)
{
            var nm="proj" + projectileCount;
            projectileLayer.attachMovie(type,nm,projectileCount);
            projectileLayer[nm]._x = x;
            projectileLayer[nm]._y=y;
            projectileLayer[nm].dx=dx;
            projectileLayer[nm].dy=dy;
           
            projectileLayer[nm].onEnterFrame=function()
            {
                        this._x += this.dx;
                        this._y += this.dy;
                       
                        if (this._y <0) this.removeMovieClip();
                       
                        for(var i = 0; i < 10; i++)
                        {
                                    var enm="enemy" + i;
                                    if(this.hitTest(enemyLayer[enm]) && enemyLayer[enm]._currentframe == 1)
                                    {
                                                enemyLayer[enm].play();
                                                score++;
                                                score_txt.text=score;
                                                this.removeMovieClip();
                                    }
                        }
            }
            projectileCount++;
            projectileCount %= 10;
}
createEnemy = function(type,x,y)
{
            var nm = "enemy" + enemyCount;
            enemyLayer.attachMovie(type,nm,enemyCount);
            enemyLayer[nm]._x = x;
            enemyLayer[nm].xline = x;
            enemyLayer[nm]._y = y;
            enemyLayer[nm].dy = Math.random() * 3 + 10;
            enemyLayer[nm].t = Math.random() * 6.28;
           
            enemyLayer[nm].onEnterFrame=function()
            {
                        this._x = this.xline + Math.sin(this.t) * 100;
                        this._y += this.dy;
                       
                        this.t += 0.1;
                       
                        if (this._currentframe == 1 && ship.hitTest(this._x, this._y, true))
                        {
                                    counter=1;
                                    doCounter();
                                    ship.play();
                        }
                       
                        if (this._y > 500) this.removeMovieClip();
            }
           
            enemyCount ++;
            enemyCount %= 10;
}
startButton.onRelease=function()
{
            this._visible=false;
            setup();
}

0 comments

No comments yet. Be the first one to comment!

just me

April 4 2008, 12:13 PM

titleScreen.onRelease = function()
{
 this._visible = false;
 startgame();
}

startgame = function()
{
 for (var i = 0;i<9;i++)
 {
  var nm = "m" + i;
  
  _root[nm].onPress = function()
  {
   if (this._currentframe == 10)
   {
    this.play();
    whacks++;
    scoreDisplay.whack_txt.text = whacks;
    doWhackAt(_xmouse,_ymouse);
   }
  }
  
  _root[nm].onEnterFrame = function()
  {
   if(this._currentframe == 1)
   {
    if ((Math.random()* 100) <1)
    {
     this.play();
    }
   }
   else if (this._currentframe == 10)
   {
    if((Math.random() * 100) < 10)
    {
     this.play();
    }
   }
  }
 }
 
 whacks = 0;
 scoreDisplay.whack_txt.text =whacks;
 endTime=getTimer()+30000;
 
 _root.onEnterFrame = function()
 {
  var etime=endTime-getTimer();
  
  if(etime<=0)
  {
   scoreDisplay.time_txt.text="Times Up";
   
   for(var i = 0;i<0;i++)
   {
    varnm = "m" + i;
    delte_root[nm].onPress
    delete_root[nm].onEnterFrame;
    _root[nm].stop();
    delete_root.onEnterFrame;
   }
  }
  else
  {
   scoreDisplay.time_txt.text=Math.ceil(etime/1000)+"sec";
  }
 }
}

went=0;
doWhackAt=function(x,y)
{
 varnm="wc"+went;
 _root.attachMovie("wackSign",nm,wcnt+99);
 _root[nm]._x=x;
 _root[nm]._y=y;
 _root[nm]._xscale=_root[nm]._yscale=60;
 
 _root[nm].onEnterFrame=function()
 {
  this._alpha-=10;
  if(this.alpha<=10)
  {
   deletethis.onEnterFrame;
   this.removeMovieClip();
  }
 }
 
 went++;
 went%=5;
}

0 comments

No comments yet. Be the first one to comment!

M¥ LÌ£È

March 12 2008, 12:24 PM

So i was born in eugene oregon (all my relatives live there) then i moved to ney york for like 7 months then i moved to vermount for like 3 years then atfer that we moved to colorado springs and moved to different houses then me n my dad got in fights like one night he threw me against a door and chocked me then threw me on the ground and like sat on me and then he hit me really hard in my ribs and kicked me out at night so my mom diovorced him and me my brother and her all moved away so then she meet a guy and we moved in with him and dats were i am now going to coranado high school

2 comments

big-fun-little-package: aw im sorry! my dad is like that but i cant get ride... 03-18-08 10:40 AM
LethalxTreat: CRAZY!!!!!!!!!!!! 03-12-08 12:30 PM

Profile

LethalxTreat
  • Male
  • 14 years old

Statistics

Entries 3
Comments 2
Page views 1,980
Last update May 12, 2008

Categories

Credits

Layout by: envisionartist