home *** CD-ROM | disk | FTP | other *** search
- function bump()
- {
- if(sensorHBump[i] == "left")
- {
- if(_parent.matter.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- if(0 < vx)
- {
- vx *= bumpAmount;
- }
- _X = _X - 1;
- }
- }
- else if(sensorHBump[i] == "right")
- {
- if(_parent.matter.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- if(vx < 0)
- {
- vx *= bumpAmount;
- }
- _X = _X + 1;
- }
- }
- if(sensorVBump[i] == "up")
- {
- if(_parent.matter.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- if(0 < vy)
- {
- vy *= bumpAmount;
- }
- _Y = _Y - 1;
- }
- }
- else if(sensorVBump[i] == "down")
- {
- if(_parent.matter.hitTest(_X + sensorX[i],_Y + sensorY[i],true))
- {
- if(vy < 0)
- {
- vy *= bumpAmount;
- }
- if(i == 9)
- {
- _Y = _Y + 1;
- }
- }
- }
- }
- function fillUp()
- {
- actEnergy = maxEnergy;
- actShots = maxShots;
- }
- function completeCollisionCheck()
- {
- collision = false;
- if(_parent.matter.hitTest(_X + sensorX[5],_Y + sensorY[5],true))
- {
- collision = true;
- }
- if(_parent.matter.hitTest(_X + sensorX[6],_Y + sensorY[6],true))
- {
- collision = true;
- }
- if(_parent.matter.hitTest(_X + sensorX[7],_Y + sensorY[7],true))
- {
- collision = true;
- }
- if(_parent.matter.hitTest(_X + sensorX[8],_Y + sensorY[8],true))
- {
- collision = true;
- }
- if(_parent.matter.hitTest(_X + sensorX[9],_Y + sensorY[9],true))
- {
- collision = true;
- }
- }
- function checkBorderCollision()
- {
- if(_X + sensorX[5] < 0)
- {
- vx = Math.abs(vx * bumpAmount);
- _X = - sensorX[5];
- }
- if(550 < _X + sensorX[6])
- {
- vx = Math.abs(vx) * bumpAmount;
- _X = 550 - sensorX[6];
- }
- if(_Y + sensorY[9] < 0)
- {
- vy = Math.abs(vy * bumpAmount);
- _Y = - sensorY[9];
- }
- if(339 < _Y)
- {
- vy = Math.abs(vy) * bumpAmount;
- _Y = 339;
- }
- }
- ay = -0.5;
- ax = 0.5;
- ground = true;
- sensorX = new Array();
- sensorY = new Array();
- sensorHBump = new Array();
- sensorVBump = new Array();
- sensorX[0] = -11;
- sensorY[0] = 0;
- sensorHBump[0] = "right";
- sensorVBump[0] = "up";
- sensorX[1] = 11;
- sensorY[1] = 0;
- sensorHBump[1] = "left";
- sensorVBump[1] = "up";
- sensorX[2] = 0;
- sensorY[2] = 2;
- sensorHBump[2] = "";
- sensorVBump[2] = "up";
- sensorX[3] = -8;
- sensorY[3] = -4;
- sensorHBump[3] = "right";
- sensorVBump[3] = "up";
- sensorX[4] = 8;
- sensorY[4] = -4;
- sensorHBump[4] = "left";
- sensorVBump[4] = "up";
- sensorX[5] = -13;
- sensorY[5] = -11;
- sensorHBump[5] = "right";
- sensorVBump[5] = "";
- sensorX[6] = 13;
- sensorY[6] = -11;
- sensorHBump[6] = "left";
- sensorVBump[6] = "";
- sensorX[7] = -7;
- sensorY[7] = -4;
- sensorHBump[7] = "right";
- sensorVBump[7] = "down";
- sensorX[8] = 7;
- sensorY[8] = -4;
- sensorHBump[8] = "left";
- sensorVBump[8] = "down";
- sensorX[9] = 0;
- sensorY[9] = -21;
- sensorHBump[9] = "";
- sensorVBump[9] = "down";
- sensorX[10] = 0;
- sensorY[10] = -7;
- bumpAmount = -0.2;
-