home *** CD-ROM | disk | FTP | other *** search
- actSpeed = Math.pow(Math.abs(vy) + Math.abs(vx * 0.7),2);
- vx *= _root.cst.slowdown;
- collision = 0;
- legL = false;
- legR = false;
- legC = false;
- if(_parent.matter.platform.hitTest(_X + sensorX[0],_Y + sensorY[0],true))
- {
- collision++;
- legL = true;
- }
- if(_parent.matter.platform.hitTest(_X + sensorX[1],_Y + sensorY[1],true))
- {
- collision++;
- legR = true;
- }
- if(_parent.matter.platform.hitTest(_X + sensorX[2],_Y + sensorY[2],true))
- {
- collision++;
- legC = true;
- }
- if(legL == true && legR != true)
- {
- if(_parent.matter.platform.hitTest(_X + sensorX[1],_Y + sensorY[1] + 3.5,true))
- {
- rotate = 2;
- maxrotate = 5;
- }
- else
- {
- rotate = 3;
- maxrotate = 10;
- }
- }
- if(legR == true && legL != true)
- {
- if(_parent.matter.platform.hitTest(_X + sensorX[0],_Y + sensorY[0] + 3.5,true))
- {
- rotate = -2;
- maxrotate = 5;
- }
- else
- {
- rotate = -3;
- maxrotate = 10;
- }
- }
- if(legL != true && legR != true)
- {
- rotate = 0;
- }
- if(1 < collision)
- {
- ground = true;
- fireLeft.gotoAndStop("inactive");
- fireRight.gotoAndStop("inactive");
- bumpDamage();
- vy = 0;
- vx = 0;
- if(0 >= actFuel)
- {
- gotoAndPlay(18);
- }
- if(Math.abs(_rotation) < maxrotate && rotate != 0)
- {
- _rotation = _rotation + rotate;
- _Y = _Y + 0.2;
- }
- i = 5;
- while(6 >= i)
- {
- bump();
- i++;
- }
- }
- else
- {
- ground = false;
- _rotation = _rotation * 0.9;
- vy += _root.cst.gravity;
- }
- completeCollisionCheck();
- if(collision == true)
- {
- if(_parent.matter.active.goal.hitTest(_X + sensorX[10],_Y + sensorY[10],true))
- {
- gotoAndStop(8);
- }
- collision = false;
- i = 5;
- while(9 >= i)
- {
- if(_parent.matter.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- if(_parent.matter.danger.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- gotoAndPlay(18);
- }
- if(_parent.matter.active.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- if(_parent.matter.active.object_1.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_1.hit();
- }
- if(_parent.matter.active.object_2.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_2.hit();
- }
- if(_parent.matter.active.object_3.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_3.hit();
- }
- if(_parent.matter.active.object_4.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_4.hit();
- }
- if(_parent.matter.active.object_5.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_5.hit();
- }
- if(_parent.matter.active.object_6.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_6.hit();
- }
- if(_parent.matter.active.object_7.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_7.hit();
- }
- if(_parent.matter.active.object_8.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_8.hit();
- }
- if(_parent.matter.active.object_9.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_9.hit();
- }
- if(_parent.matter.active.object_10.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_10.hit();
- }
- if(_parent.matter.active.object_11.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_11.hit();
- }
- if(_parent.matter.active.object_12.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_12.hit();
- }
- if(_parent.matter.active.object_13.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_13.hit();
- }
- if(_parent.matter.active.object_14.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_14.hit();
- }
- if(_parent.matter.active.object_15.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_15.hit();
- }
- if(_parent.matter.active.object_16.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_16.hit();
- }
- if(_parent.matter.active.object_17.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_17.hit();
- }
- if(_parent.matter.active.object_18.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_18.hit();
- }
- if(_parent.matter.active.object_19.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_19.hit();
- }
- if(_parent.matter.active.object_20.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- _parent.matter.active.object_20.hit();
- }
- }
- else
- {
- bump();
- }
- }
- i++;
- }
- }
- checkBorderCollision();
- if(0 < actFuel)
- {
- if(Key.isDown(Key.UP))
- {
- vy += ay;
- actFuel -= burnFuelUp;
- burnFuel();
- fireDown.gotoAndStop("fire");
- }
- else
- {
- fireDown.gotoAndStop("inactive");
- }
- if(Key.isDown(Key.LEFT))
- {
- if(ground == true)
- {
- vy += ay;
- }
- vx -= ax;
- actFuel -= burnFuelSide;
- burnFuel();
- fireRight.gotoAndStop("fire");
- _rotation = _rotation * 0.98 + 1;
- shootLeft = true;
- }
- else
- {
- fireRight.gotoAndStop("inactive");
- }
- if(Key.isDown(Key.RIGHT))
- {
- if(ground == true)
- {
- vy += ay;
- }
- vx += ax;
- actFuel -= burnFuelSide;
- burnFuel();
- fireLeft.gotoAndStop("fire");
- _rotation = _rotation * 0.98 - 1;
- shootLeft = false;
- }
- else
- {
- fireLeft.gotoAndStop("inactive");
- }
- }
- else
- {
- fireLeft.gotoAndStop("inactive");
- fireRight.gotoAndStop("inactive");
- fireDown.gotoAndStop("inactive");
- }
- _X = _X + vx;
- _Y = _Y + vy;
- if(Key.isDown(Key.SPACE))
- {
- if(0 < actShots)
- {
- if(_parent.shot.ready == true)
- {
- if(shootLeft != true)
- {
- _parent.shot._x = _X + 15;
- _parent.shot._y = _Y - 8;
- _parent.shot.vx = 3;
- }
- else
- {
- _parent.shot._x = _X - 15;
- _parent.shot._y = _Y - 8;
- _parent.shot.vx = -3;
- }
- _parent.shot.ready = false;
- actShots--;
- refreshShots();
- _parent.shot.gotoAndPlay("shoot");
- }
- }
- }
-