5 Replies Latest reply on Jul 23, 2008 8:50 AM by robin1232

    variable

    robin1232 Level 1
      okay, im making a simple click the ball minigame and I have it scripted but the problem is that the variable doesnt increase by one with each click but the first time you click it it'll turn to 1 the second 11 the third 111
      the script is
      on (press) {
      _root.score += 1;
      }
      and yes the button is inside a movieclip so I had to do the _root thing
      also, I want the movieclip to bounce from above to down if its moving from above to down and vice versa
      that script is
      onClipEvent (load) {
      dx = 4;
      dy = 4;
      }
      onClipEvent (enterFrame) {
      _x += dx;
      _y += dy;
      if (_x<-100) {
      _x = -100;
      dx *= -1;
      } else if (_x>700) {
      _x = 700;
      dx *= -1;
      }
      if (_y<0) {
      _y = 0;
      dy *= -1;
      } else if (_y>300) {
      _y = 300;
      dy *= -1;
      }

      if (this._x<-50){
      dx = 4;
      dy = -4;
      }
      if (this._x>650){
      dx = -4;
      dy = 4;
      }
      }