1 Reply Latest reply on Sep 11, 2011 7:24 PM by Ned Murphy

    Flash Background help

    Flash Name here

      Hello, right now i am working on a first person shooter, not one of those ones seen on youtube where the gun moves and the background stays in place, but vice versa. Right now i'm trying to rig it so when you press the "UP" key you'll open a menu where you cant shoot, aim.etc I got 1 problem, how do i rig it so that when i pres up, the background stops moving? The code i'm using for the background is:

       

      onClipEvent(enterFrame){
      Mouse.hide();
      this._x =-_root._xmouse+400;
      this._y =-_root._ymouse+200;
      }

       

      Please help!

       

      BTW, you can chech out the beta of this game at Newgrounds.com, by the user: HarryboEntertainment

        • 1. Re: Flash Background help
          Ned Murphy Adobe Community Professional & MVP

          One way to control execution of code is to introduce a conditional.

           

          onClipEvent(enterFrame){

             if(allowMovement){
                Mouse.hide();
                this._x =-_root._xmouse+400;
                this._y =-_root._ymouse+200;

             }
          }

           

          So when you press the UP key you would set the allowMovement variable to false, and whatever you do to resume play would set it true again.  You may need to adjust targeting the variable.