5 Replies Latest reply on Oct 16, 2008 11:07 AM by Bob220867

    Film loops and rotation

    Bob220867
      I have a character that is seen from the top and I can move and rotate it - as long as it is a single image. However, I've put together a 4 frame film loop and the film loop won't rotate. Is there any way to do that - rotate a film loop? Can I get at the sprites in the film loop instead? I can use an animated gif but the line quality is a bit rubbish. Would a small linked movie be controllable? Any other suggestions?

      Thanks
        • 1. Re: Film loops and rotation
          Production Monkey Level 3
          You can get access to any of the loop's sprites through the loop-sprite's movie property. Assuming you used sprite channel 1 for your 4 frame loop, then the following behavior will rotate those sprites inside the film loop.

          property pMovieSprite

          on beginSprite me
          pMovieSprite = sprite(me.spriteNum).movie.sprite(1)
          end


          on enterframe me
          pMovieSprite.rotation = pMovieSprite.rotation + 10
          end
          --------------------------------------------------

          In the property inspector select the "Film Loop" tab for your film loop member and select the "Crop" and "Center" radio buttons. This will enable you to resize the film loop sprite to fix any cropping issues.

          Note: This will also work for LDMs - Linked Director Movies, if you want to use these "Loops" across multiple movies.
          • 2. Re: Film loops and rotation
            Bob220867 Level 1
            Thanks for this. The film loop consists of 4 (4 frame stills) sprites in a row to suggest a walk cycle. I had a go with it but the sprite insists on 'switching back' to its original rotation before being set to the current desired rotation. Presumably as it meets each sprite it has to correct it. I tried a couple of different event handlers (enter, exit, prepareframe) but didn't seem to make any difference. I may just have to settle for the animated gif.
            • 3. Re: Film loops and rotation
              Production Monkey Level 3
              Right. The beginsprite is resetting the value.

              If you use a behavior to cycle through the walk cycle images it should work. You will need to call exitFrame directly on the sprite inside the film loop to make it work though.

              I know that is a bit cryptic. I'll try to post some code tomorrow if you have not figured it out by then.

              Here's a link to more details on how to control a film loop. http://director-online.com/forums/read.php?2,10116,10148#msg-10148
              • 4. Re: Film loops and rotation
                Production Monkey Level 3
                I threw together a basic image cycling behavior. To use it, place your walk cycle images in their own folder. Drag the first image to the stage and attach the behavior. You should have the same effect as a film loop, except now you can rotate the sprite because it is not a film loop.

                Depending on your needs you may want to create each movement cycle as a seperate Director movie and then bring them into your main movie as linked Director movies with the "scripts enabled" button checked. This would make things more modular. If you take this route then the Rotation script I provided will work.
                • 5. Re: Film loops and rotation
                  Bob220867 Level 1
                  Hey PM
                  Thanks for the time you put in on this. There's always a way round Director's seeming (or actual) shortcomings.