5 Replies Latest reply on Mar 24, 2010 1:17 PM by kglad

    can somebody explain me this code pls!

    NikolaV97 Level 1

      speed *= .98;
          x = Math.sin(_rotation*(Math.PI/180))*speed*-1;
          y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
          if (!_root.granica.hitTest(_x+x, _y+y, true)) {
              _x += x;
              _y += y;
          } else {
              speed *= -.6;
      }

       

      root granica is an instance name i used, it can be anything else...

      i believe shat speed is a variable or sth, cus i already used it earlier in the code and i guess now im just defining it...

      but can somebody pleasee help me out by explaining what part of the code means what...

      btw i also think that it has something to do with trigonometric functions, that sin and cos...

      tnx in advance