5 Replies Latest reply on May 1, 2007 10:55 AM by m@rkit

    Some Help Please. Shooting Game

    m@rkit Level 1
      Right the basic story is that im making this game where animals cross the screen and you shoot them (aka click the mouse on them) and get points. Im having a couple of problems.

      I wanted to have the gunshot noise whenever i clicked ANYWHERE so i put it in the mousup in a frame script but when i click on a sprite which has its own behavior, it doesnt play

      Secondly, there are items on the stage such as waves and grass that the animals can hide behind and i can still click on them even if i cant see them, ie click the part of the grass they are hiding behind. How do i correct this...

      Any help would be appreaciated. Thank you!!!
        • 1. Some Help Please. Shooting Game
          jclegs
          use puppetsound for the sound
          • 2. Re: Some Help Please. Shooting Game
            Level 7
            Put the mouseUp on the items as well.

            put a transparent shape cast member with a blend of 0 over the protected
            areas and put a mouseUp handler on them that has nothing in it. The mouse
            click will be captured.

            Of course there are many, many ways to accomplilsh what you want.

            --
            Craig Wollman
            Lingo Specialist
            Word of Mouth Productions
            212-928-9581

            www.wordofmouthpros.com
            "m@rkit" <webforumsuser@macromedia.com> wrote in message
            news:f176pl$k6k$1@forums.macromedia.com...
            > Right the basic story is that im making this game where animals cross the
            > screen and you shoot them (aka click the mouse on them) and get points. Im
            > having a couple of problems.
            >
            > I wanted to have the gunshot noise whenever i clicked ANYWHERE so i put it
            > in
            > the mousup in a frame script but when i click on the sprite it doesnt play
            > the
            > sound.
            >
            > Secondly, there are items on the stage such as waves and grass that the
            > animals can hide behind and i can still click on them even if i cant see
            > them,
            > ie click the part of the grass they are hiding behind. How do i correct
            > this...
            >
            > Any help would be appreaciated. Thank you!!!
            >


            • 3. Re: Some Help Please. Shooting Game
              Level 7
              You don't normally attach user event code to a frame. User events, like
              mouse clicks, are normally associated with an individual item, like a
              sprite. Shooter games get around this limitation by using key events for
              the shooting action. Since key events are read by the computer and then
              sent to the Director movie, they can be read by a keyDown or keyUp
              script.

              There is a corollary for the mouse, the mouseDown and the mouseUp
              script. Since any system wide property like a keyDownScript or a
              mouseDownScript will take all key or mouse events, they need to be used
              with care and caution. While this is not usually a big problem with key
              events, mouse events are likely to cause some difficulty. While the
              mouseDownScript will always execute first, it will most likely pass the
              event on to any active sprite. This may or may not be what you want to
              have happen, you may want an either/or situation not an and situation.

              A simple way to block a sprite's behavior when it is hidden is to place
              a stopEvent command on the sprite that sits on top.

              --
              Rob
              _______
              Rob Dillon
              Adobe Community Expert
              http://www.ddg-designs.com
              412-243-9119

              http://www.macromedia.com/software/trial/
              • 4. Re: Some Help Please. Shooting Game
                James Newton, ACP Level 3
                If a behavior handles the mouseUp event, the mouseUp event will not be automatically forwarded to the Movie Script. You need to explicitly "pass" the event up the hierarchy:

                on mouseUp(me)
                -- do sprite stuff

                pass
                put "This line will not be executed: pass acts like 'exit' or 'return'"
                end
                • 5. Re: Some Help Please. Shooting Game
                  m@rkit Level 1
                  thank you so much, now that u mention that, i do remember doing about it but not quite understanding what it did. Thank you to everyone else to for their suggestions and solutions!!!!