home *** CD-ROM | disk | FTP | other *** search
- function moveRight()
- {
- if(boy._x + width < rBounds - 5 && !animActive)
- {
- boy._x += xspeed;
- boy.stand.gotoAndStop(2);
- }
- }
- function moveLeft()
- {
- if(lBounds + 5 < boy._x - width && !animActive)
- {
- boy._x -= xspeed;
- boy.stand.gotoAndStop(2);
- }
- }
- function lateralFall()
- {
- if(boy._x - width < lLedge || rLedge < boy._x + width)
- {
- findGlobal(bBottom._y);
- boy._y = Math.round(bBottom._y);
- bottom = Math.round(bBottom._y);
- lLedge = Math.round(bBottom._x);
- rLedge = Math.round(bBottom._x + bBottom._width);
- boy.gotoAndPlay("falling");
- ySpeed = 0;
- jumping = 0;
- }
- }
- function jumpCommand()
- {
- if(jumping == 0 && !animActive)
- {
- ySpeed -= jumpPower;
- jumping = 1;
- boy.gotoAndPlay("jump");
- }
- }
- function jumpMovement()
- {
- hitLedgeTest();
- if(bottom < y && jumping == 1)
- {
- if(boy._x - width < lLedge || rLedge < boy._x + width)
- {
- findGlobal(bBottom._y);
- boy._y = Math.round(bBottom._y);
- bottom = Math.round(bBottom._y);
- lLedge = Math.round(bBottom._x);
- rLedge = Math.round(bBottom._x + bBottom._width);
- boy.gotoAndPlay("falling");
- ySpeed = 0;
- jumping = 0;
- }
- else
- {
- ySpeed = 0;
- y = bottom;
- boy.gotoAndStop("standing");
- jumping = 0;
- }
- }
- else
- {
- y = boy._y;
- ySpeed += gam2Yinc;
- y += ySpeed / 8;
- boy._y = y;
- }
- }
- function hitLedgeTest()
- {
- var tempBottom;
- i = 1;
- while(ledgeNum >= i)
- {
- if(boy.grabArea.hitTest(this["l" + i].ledge))
- {
- if(this["l" + i] == this["l" + ledgeNum])
- {
- boyHitTop = true;
- }
- bottom = this["l" + i]._y;
- lLedge = Math.round(this["l" + i]._x);
- rLedge = Math.round(this["l" + i]._x + this["l" + i]._width);
- ySpeed = 0;
- boy._y = bottom;
- boy.gotoAndStop("climbing");
- jumping = 0;
- tempBottom = bottom;
- findGlobal(tempBottom);
- }
- i++;
- }
- }
- function findGlobal(tempBottom)
- {
- var tempBottom;
- var point = new Object();
- point.x = tempBottom;
- point.y = tempBottom;
- this.localToGlobal(point);
- yDist = viewPosition - point.y;
- needNewView = true;
- }
- function adjustView()
- {
- yDist -= scrollSpeed;
- scrollSpeed = yDist * deAccel;
- this._y += scrollSpeed;
- if(Math.abs(yDist) < 1)
- {
- needNewView = false;
- }
- }
- var ledgeNum = 21;
- var bottom = Math.round(bBottom._y);
- var lLedge = Math.round(bBottom._x);
- var rLedge = Math.round(bBottom._x + bBottom._width);
- var rBounds = Math.round(bBottom._x + bBottom._width);
- var lBounds = Math.round(bBottom._x);
- var width = 10;
- var height = 42;
- var jumpPower = 90;
- var game2time;
- var animActive = false;
- var needNewView = false;
- var boyHitTop = false;
- var jumping = 0;
- var boundsTop = Math.round(_root.btop._y);
- var deAccel = 0.25;
- var scrollSpeed = 0;
- var viewPosition = _root.viewPoint._y;
- var ySpeed;
- var xSpeed = 4;
- var gam2Yinc = 4;
- var gam2Xinc = 3;
-