4 Replies Latest reply on May 3, 2007 2:35 PM by liquidleaf

    Need  help with homework

    kristiehewlett Level 1
      This file can be downloaded from https://lamp.cpcc.edu/~klh46d02/kris/
      Here is the flash and text file. In frame 10, I am moving all the object names(l01-l08) to x_800. and when the 8th item is moved, I want to go to the next frame. The following is the code entered into frame 10. Why isn't it working? I have other questions too, if possible.
      Code in actionscript frame 10.
      if ((_root.l01._x == 800) && (_root.l02._x == 800) && (_root.l03._x == 800) && (_root.l04._x == 800) && (_root.l05._x == 800) && (_root.l06._x == 800) && (_root.l07._x == 800) && (_root.l08._x == 800))
      {
      gotoAndPlay(12);
      } Text
        • 1. Re: Need  help with homework
          liquidleaf Level 1
          Where exactly are you setting the _x of each of these objects?

          The code you list only tests to see if they already have _x = 800, it doesn't set them.

          If you want to move them all at once, just use
          for (i=1; i <=8; i++)
          {
          _root["l0"+ i]._x = 800;
          }
          gotoAndPlay(12);
          • 2. Re: Need  help with homework
            kristiehewlett Level 1
            When the player releases the button the button and description is moved.
            on (press){
            _root.l01._x = 800;
            _root.l01._y = 800;
            _root.sandals._x = 529;
            _root.sandals._y = 372;

            yspeed = 0;

            xspeed = 0;

            wind = 0.00;

            power = 0.65;

            gravity = 0.1;

            upconstant = 0.75;

            friction = 0.99;




            }

            the last 5 lines , I tried to move the items slowly...not working. Can you see game. Download to view? It's due tomorrow at school.
            • 3. Re: Need  help with homework
              kristiehewlett Level 1
              When the player releases the button the button and description is moved.
              on (press){
              _root.l01._x = 800;
              _root.l01._y = 800;
              _root.sandals._x = 529;
              _root.sandals._y = 372;

              yspeed = 0;

              xspeed = 0;

              wind = 0.00;

              power = 0.65;

              gravity = 0.1;

              upconstant = 0.75;

              friction = 0.99;




              }

              the last 5 lines , I tried to move the items slowly...not working. Can you see game. Download to view? It's due tomorrow at school.
              • 4. Re: Need  help with homework
                liquidleaf Level 1
                There are quite a lot of large problems with your project.

                The main one - your check on Frame 10 only happens once, when the playhead enters frame 10 the first time. It doesn't repeatedly check to see if the user has moved anything, just fires one time, just after the user clicks "ENTER".

                You cannot move objects with gravity, friction etc in the way you are trying to do. The only thing that happens is that the items are repositioned instantly with the new x,y coordinates. You can't tween (animate) an item like you're trying.

                My recommendation to you would be to have your loop statement (checking the position of all 8 elements) on Frame 11. Put an "else" in on your if (j == 8) statement to gotoAndStop(11), so it will continually loop on that frame until j == 8, at which point it will go to frame 12.

                Good luck. Programming structures can be hard enough to learn on their own, add a timeline like Flash and it gets far more confusing.