home *** CD-ROM | disk | FTP | other *** search
- this.attachMovie("game_ship_graphic#" + _root.shipType,"graphic",0);
- accel = _root.shipsArray[_root.shipType][0];
- speed = _root.shipsArray[_root.shipType][1];
- rotate = _root.shipsArray[_root.shipType][2];
- brakepower = _root.shipsArray[_root.shipType][3];
- keyBlue = false;
- keyGreen = false;
- keyRed = false;
- keyYellow = false;
- keyCyan = false;
- keyPink = false;
- active = true;
- this.onEnterFrame = function()
- {
- var _loc1_ = _root;
- var _loc2_ = this;
- if(active == true && _loc1_.game.paused == false)
- {
- if(accel > _loc1_.limitsArray[0][1])
- {
- accel = _loc1_.limitsArray[0][1];
- }
- else if(accel < _loc1_.limitsArray[0][0])
- {
- accel = _loc1_.limitsArray[0][0];
- }
- if(speed > _loc1_.limitsArray[1][1])
- {
- speed = _loc1_.limitsArray[1][1];
- }
- else if(speed < _loc1_.limitsArray[1][0])
- {
- speed = _loc1_.limitsArray[1][0];
- }
- if(rotate > _loc1_.limitsArray[2][1])
- {
- rotate = _loc1_.limitsArray[2][1];
- }
- else if(rotate < _loc1_.limitsArray[2][0])
- {
- rotate = _loc1_.limitsArray[2][0];
- }
- if(brakepower > _loc1_.limitsArray[3][1])
- {
- brakepower = _loc1_.limitsArray[3][1];
- }
- else if(brakepower < _loc1_.limitsArray[3][0])
- {
- brakepower = _loc1_.limitsArray[3][0];
- }
- if(Key.isDown(38))
- {
- moveX += accel * Math.sin(_rotation * 0.017453292519943295);
- moveY -= accel * Math.cos(_rotation * 0.017453292519943295);
- _loc2_.graphic.thrust._visible = true;
- _loc1_.fSJ("on");
- }
- else
- {
- _loc2_.graphic.thrust._visible = false;
- _loc1_.fSJ("off");
- }
- if(Key.isDown(32) || Key.isDown(40))
- {
- moveX *= _loc1_.limitsArray[3][0] + (_loc1_.limitsArray[3][1] - brakepower);
- moveY *= _loc1_.limitsArray[3][0] + (_loc1_.limitsArray[3][1] - brakepower);
- }
- if(Key.isDown(37) && Key.isDown(39))
- {
- rotation = 0;
- _loc2_.graphic.left._visible = true;
- _loc2_.graphic.right._visible = true;
- _loc1_.fSJs("on");
- }
- else if(Key.isDown(37) || Key.isDown(39))
- {
- rotation = 0;
- _loc2_.graphic.left._visible = false;
- _loc2_.graphic.right._visible = false;
- if(Key.isDown(37))
- {
- rotation = - rotate;
- _loc2_.graphic.left._visible = true;
- }
- if(Key.isDown(39))
- {
- rotation = rotate;
- _loc2_.graphic.right._visible = true;
- }
- _loc1_.fSJs("on");
- }
- else
- {
- _loc1_.fSJs("off");
- rotation = 0;
- _loc2_.graphic.left._visible = false;
- _loc2_.graphic.right._visible = false;
- }
- currentSpeed = Math.sqrt(moveX * moveX + moveY * moveY);
- if(currentSpeed >= speed)
- {
- moveX *= speed / currentSpeed;
- moveY *= speed / currentSpeed;
- }
- finalMoveX = moveX * _loc1_.timeSecs;
- finalMoveY = moveY * _loc1_.timeSecs;
- finalRotation = rotation * _loc1_.timeSecs;
- _loc2_._rotation += finalRotation;
- _loc1_.game.world._x -= finalMoveX;
- _loc1_.game.world._y -= finalMoveY;
- _loc1_.game.objects._x -= finalMoveX;
- _loc1_.game.objects._y -= finalMoveY;
- _loc1_.fMoveStars(finalMoveX,finalMoveY);
- }
- else
- {
- _loc1_.fSJ("off");
- _loc1_.fSJs("off");
- _loc2_.graphic.thrust._visible = false;
- _loc2_.graphic.left._visible = false;
- _loc2_.graphic.right._visible = false;
- }
- };
-