home *** CD-ROM | disk | FTP | other *** search
- function shipparent()
- {
- this.rotation = 0;
- this.xpos = 100;
- this.ypos = 300;
- this.xlration = 0;
- this.rockets = 1;
- this.xspeed = 0;
- this.yspeed = 0;
- this.hitstatus = 0;
- }
- function rocketparent()
- {
- this.rotation = 0;
- this.xpos = -50;
- this.ypos = -50;
- this.xlration = 0;
- this.distancetravelled = 0;
- this.xspeedship = 0;
- this.yspeedship = 0;
- this.xspeed = 0;
- this.yspeed = 0;
- }
- function rightturn()
- {
- ship.rotation += 5;
- }
- function leftturn()
- {
- ship.rotation -= 5;
- }
- function forward()
- {
- tellTarget(car)
- {
- gotoAndPlay(5);
- }
- if(8 >= ship.xlration)
- {
- ship.xlration += 0.3;
- }
- }
- function slowdown()
- {
- if(0 < ship.xlration)
- {
- ship.xlration -= 0.1;
- }
- }
- function fire()
- {
- if(counter >= 30)
- {
- counter = 0;
- if(ship.rockets < 50)
- {
- rocketarray.unshift(ship.rockets);
- rocket[ship.rockets].xspeedship = ship.xspeed;
- rocket[ship.rockets].yspeedship = ship.yspeed;
- setProperty(rocket add ship.rockets, _rotation, ship.rotation);
- setProperty(rocket add ship.rockets, _X, ship.xpos);
- setProperty(rocket add ship.rockets, _Y, ship.ypos);
- rocket[ship.rockets].rotation = ship.rotation;
- ship.rockets += 1;
- rocketsleft -= 1;
- if(rocketsleft == 0)
- {
- gotoAndStop(10);
- }
- }
- }
- }
- function moverockets()
- {
- x = 0;
- while(rocketarray.length >= x)
- {
- i = rocketarray[x];
- if(eval(rocket add i).hitTest(_root.enemy))
- {
- ship.hitstatus += 1;
- shipscore = ship.hitstatus;
- blah = rocketarray.pop();
- tellTarget(rocket add i)
- {
- play();
- }
- }
- rocket[i].xpos = getProperty(rocket add i, _X);
- rocket[i].ypos = getProperty(rocket add i, _Y);
- rocket[i].xlration += 0.5;
- rocket[i].xspeed = Math.sin(0.017453292519943295 * rocket[i].rotation) + rocket[i].xspeedship;
- rocket[i].yspeed = - Math.cos(0.017453292519943295 * rocket[i].rotation) + rocket[i].yspeedship;
- rocket[i].xpos += rocket[i].xspeed * rocket[i].xlration;
- rocket[i].ypos += rocket[i].yspeed * rocket[i].xlration;
- setProperty(rocket add i, _X, rocket[i].xpos);
- setProperty(rocket add i, _Y, rocket[i].ypos);
- rocket[i].distancetravelled += 1;
- if(140 < rocket[i].distancetravelled)
- {
- blah = rocketarray.pop();
- tellTarget(rocket add i)
- {
- play();
- }
- }
- x++;
- }
- }
- function moveship()
- {
- dir = car._rotation + 180;
- ship.xspeed = newsin[dir] * (- ship.xlration);
- ship.yspeed = newcos[dir] * ship.xlration;
- ship.xpos += ship.xspeed;
- ship.ypos += ship.yspeed;
- if(ship.xpos >= 650)
- {
- ship.xpos = -40;
- }
- else if(-40 >= ship.xpos)
- {
- ship.xpos = 650;
- }
- if(ship.ypos >= 400)
- {
- ship.ypos = -40;
- }
- else if(-40 >= ship.ypos)
- {
- ship.ypos = 400;
- }
- setProperty(car, _rotation, ship.rotation);
- setProperty(car, _X, ship.xpos);
- setProperty(car, _Y, ship.ypos);
- }
- ship = new shipparent();
- i = 1;
- while(50 >= i)
- {
- rocket[i] = new rocketparent();
- duplicateMovieClip(rocket,"rocket" add i,16384 + i);
- i++;
- }
- shipscore = 0;
- rocketsleft = 49;
- rocketarray = [];
- counter = 0;
- statecounter = 0;
- statelength = 0;
- newsin = [];
- newcos = [];
- i = 1;
- while(360 >= i)
- {
- newsin[i] = Math.sin(0.017453292519943295 * i);
- newcos[i] = Math.cos(0.017453292519943295 * i);
- i++;
- }
-