3 Replies Latest reply on Apr 4, 2014 11:22 AM by jackblackweb

    check if sprite is off screen

    xirokx

      Hi there guys,

       

      I am making a game which has a gun that fires bullets, Id like the gun to fire so long as the previous bullet is off the stage

       

      Whats the easiest way to do this please?

       

      I tried:

       

      if sprite(13).locV = < -100 then  

         variable 1 = false

      end if

       

      but it does not work, it allows me to repeatedly fire and cancels the existing bullet on the screen so does not register a hit....

       

      any ideas what I am doing wrong please?

       

      please help

       

      thanks

       

      p.s. in an ideal world I would like to fire bullets repeatedly irrespective if existing bullets are on the stage or not and to register a hit....

        • 1. Re: check if sprite is off screen
          jackblackweb Level 1

          Xirokx,

          These smart forum folks can help.  I think more of the

          game code and aspects are needed. Is this 3D? What is the LINGO

          that fires the bullets? What version of Director? What platform?

          Good Luck,

          Jack

          • 2. Re: check if sprite is off screen
            xirokx Level 1

            Hi jack

             

            Thanks for your reply

             

            OK so the lingo for firing the bullets is inside an if statement which checks if the space key is pressed if it is then it fires. This if statement is inside an exit handler

             

            The game is not 3D, its director 11.5 on the PC

             

            I know I am real close the good thing is my code is very simple unlike the examples I found online so was hoping someone could suggest a simple solution

             

            Thanks

            • 3. Re: check if sprite is off screen
              jackblackweb Level 1

              Xirokx,

               

              Unsure without viewing the actual Lingo.

               

              Variables only work as a single string of characters with no SPACE.

               

              variable 1 = false, should cause an error alert if sprite(13).locV = < -100

               

              You're right, the simpler the code the better.

               

              Jack