1 Reply Latest reply on May 7, 2014 10:52 AM by kglad

    key and lock

    lammyhammy

      Okay Hi I am kinda of new to Flash and I been learning it in college but I don't know the code well the picture below should explain it

      [IMG]http://i62.tinypic.com/sphjxh.png[/IMG]

      Basically I want the code for this. I want the player to hit the key which will remove the lock from the screen.

      Any help appreciated thanks

        • 1. Re: key and lock
          kglad Adobe Community Professional & MVP

          use a loop (like enterframe) to repeatedly check a hittest between player and lock.  eg:

           

          this.onEnterFrame=hitF;

           

          function hitF():Void{

          if(player_mc.hitTest(lock_mc)){

          lock_mc.removeMovieClip();  // use swapDepths on lock_mc if it's at depth less than zero

          delete this.onEnterFrame;

          }

          }