7 Replies Latest reply on Jan 13, 2007 6:45 AM by sk8morestudyless

    shooting

    sk8morestudyless Level 1
      im making a side scrolling game like mario and i want to get the guy to shoot in 2 directions but i can never get it right
      does anybody have any sample code or anything beacuse i have no idea how to get the bullets to change direction
        • 1. Re: shooting
          kglad Adobe Community Professional & MVP
          what code are you using now to have "shooting" display on-stage?
          • 2. Re: shooting
            Level 7
            See my previous post! If you supply an email, I'll send you a couple of
            examples

            --
            -------------------------------
            Remove '_spamkiller_' to mail
            -------------------------------


            • 3. Re: shooting
              sk8morestudyless Level 1
              my email adress is skate_board_mortal@yahoo.com

              and the code im currently useing is somthing like this

              onClipEvent(load){
              var bulletc=0
              }

              onClipEvent(enterFrame){
              bulletc++
              if(Key.isDown(Key.Space)){
              _root.bullet.duplicatemovieclip("lbullet"+lc,lc)
              }
              }


              i just made that off of my head for only shooting in one direction
              without the code in the bullet but when i try to choot in a different direction when my "guy" flips or _xscale's when an arrow key is pressed the furthest i came to getting it was all the bullets even ones that where already "fired" changed directions at the same time
              • 4. Re: shooting
                kglad Adobe Community Professional & MVP
                that's good (that it's off the top of your head) because it won't do anything like "shooting bullets".
                • 5. Re: shooting
                  sk8morestudyless Level 1
                  what are you talking about if you put an _x+= whatever in the "bullet" mc it will duplicate the bullet at its original position that you set and will increase the x value which does replicate "shooting" but if you have any suggestions id be thankfull beacuse ive only been useing flash for acouple of months
                  • 6. Re: shooting
                    kglad Adobe Community Professional & MVP
                    yes, and IF you designate the correct start position for your bullets they will appear to shoot of the muzzle of a gun that might be on-stage and IF you designate the correct _rotation for your bullets it will appear to shoot in the direction of the barrel of a gun that might be on-stage and IF there's a gravity effect that will need to be added to the code but that's a lot of IFs that aren't in your code and a lot more code that's not there than is there.

                    to complete your coding you need a gun barrel (or something that serves the same purpose) and you need to specify the gun's elevation and whether there's a gravity effect.

                    • 7. Re: shooting
                      sk8morestudyless Level 1
                      ok i dont want somting that advanced i just want to make the "bullets" go right when the gun is facing right and left when the gun is facing left but when i do it i cant get it to work so i just want a sample code or somthing