4 Replies Latest reply on Apr 7, 2010 5:13 AM by CRB_Pat

    linking sprites together / or creating a "follow me"

    CRB_Pat

      I searched the internet and found this:

       

      property pOffset

      on beginSprite me
        pOffset = sprite(1).loc - sprite(me.spriteNum).loc
      end beginSprite

      on exitFrame me
        sprite(me.spriteNum).loc = sprite(1).loc - pOffset
      end exitFrame

       

       

      Which worked great for moving multiple objects at once, but unfortunately I also need it to scale everything at once (this lingo was provided by sean wilson on this forum) to scale the object:

       

      property spriteNum
      property my

      on beginSprite me
        my = sprite(spriteNum)
      end

      on mouseUp me
        my.width  = my.width  * 1.2
        my.height = my.height * 1.2
      end

       

       

        • 1. Re: linking sprites together / or creating a "follow me"
          James Newton, ACP Level 3

          Can you provide a bit more information about what you are trying to do?  In what context do you want to move and scale multiple sprites?  How is the movement and scaling to relate to the movement of the mouse?  How is this a "follow me" activity?

          • 2. Re: linking sprites together / or creating a "follow me"
            CRB_Pat Level 1

            The 1st sprite will be an animation (avi file) with multiple movements taking place that I'd like the user to be able to hightlight/ and click to open a new animation. Before getting to this point I want the animation to act much like a "google map" - you can pan around (instead of paning the screen, I'm moving the object), zoom in and out (instead of zoom, I'm scaling the object). So far I can accomplish all these actions, unfortunately the ability to highlight the "multiple animation movements" means I will need additional "layers" of sprites on top of the animation to control the highlight and selection. So when I zoom and move, I need to make sure the highlight sprites are following the 1st sprite (animation).

             

            I apologize if "follow me" was the incorrect wording - I've been using Director on and off since the release of version 7, but am a 3d modeler/ animator that uses Director (occassionally) to compliment my work. In 3ds Max i would develop a "dummy" that objects follow - This seemed like a good explanation for what I'm looking for.

             

            Overall, what I want is to in some way "group" or "link" several sprites together so the move and scale scirpts effect them at the same time.

            • 3. Re: linking sprites together / or creating a "follow me"
              James Newton, ACP Level 3

              Have you tried creating a film loop?  A film loop is a group of sprites that you copy from the Stage then paste into a member slot in the Cast window.  You can then drag the resulting member back onto the Stage as a single sprite.  Does this work with a video as one of the layers in the film loop?

              1 person found this helpful
              • 4. Re: linking sprites together / or creating a "follow me"
                CRB_Pat Level 1

                If I understand your answer correctly this would work (and when I have some extra time I'd like to test this idea, as i believe it would also clean up my score a bit).

                 

                I did however finally figure this out this morning - I was making this harder than it needed to be:

                 

                property spritenum

                property my

                 

                 

                on beginsprite me

                my = sprite(1)     <--adding an additional behavior (to my button) and changing the sprite to (3), now controls two sprites

                end

                 

                on mouseup me

                my.width = my.width *1.2

                my.height = my.height *1.2

                end