5 Replies Latest reply on May 25, 2009 1:25 PM by Ned Murphy

    Simple coding rotating script

    SvingXD Level 1

      I have a script to move an object in my flash already:

       

      var speed:Number = 4;
      plane_mc.onEnterFrame = function() {
      if (Key.isDown(Key.RIGHT)) {
      this.ang=ang+0.01;
      } else if (Key.isDown(Key.LEFT)) {
      this._x = this._x-speed;
      }
      if (Key.isDown(Key.UP)) {
      this._y = this._y-speed;
      } else if (Key.isDown(Key.DOWN)) {
      this._y = this._y+speed;
      }
      };

       

       

      This makes it move but now I want to object to rotate so instead of the left and right arrow keys making it move I need them to rotate them in the retrospective way. E.g. Right arrow spins object anticlockwise.

       

      Thanks for any help.