0 Replies Latest reply on Dec 29, 2007 4:23 PM by zanakno

    I need help with a simple problem!

    zanakno
      Hey i am new to forums but not new to flash but i cant figure out how to make it so i can only jump of the ground or a collision please help... Here is the code i have(i have attached as well):
      onClipEvent (enterFrame) {
      //Movement
      if (Key.isDown(Key.RIGHT)) {
      this.walk = true;
      this.walkdir = 'right';
      this.gotoAndStop('walk_right');
      this._x += 7;
      } else if (Key.isDown(Key.LEFT)) {
      this.walk = true;
      this.walkdir = 'left';
      this.gotoAndStop('walk_left');
      this._x -= 7;
      } else if (Key.isDown(Key.ALT)) {
      //Vars
      this.jump = 'false';
      if(this.walkdir == 'left')
      {
      this.gotoAndStop('jump_left');
      }
      if(this.walkdir == 'right')
      {
      this.gotoAndStop('jump_right');
      }
      if(this.jump == 'false')
      {
      this._y -= 60;
      this.jump = 'true';
      }
      else if(this.jump == 'true')
      {

      }

      } else if (this.walkdir == 'left') {
      this.walk = false;
      this.gotoAndStop('stand_left');
      } else if (this.walkdir == 'right') {
      this.walk = false;
      this.gotoAndStop('stand_right');
      }
      //Collsions
      if (this.hitTest(_root.ground))
      {
      this._y = _y-10;
      }
      if (hitTest() == false)
      {
      _y = _y+10;
      }
      if (hitTest() == true)
      {
      this.jump = false;
      }
      }