1 Reply Latest reply on Apr 28, 2014 10:53 AM by Rod@FOF

    im trying to create a "wobbling" effect with a bitmap

    pletkip Level 1

      im trying to create a "wobbling" effect with a bitmap


      any idea how to go with this with director?

        • 1. Re: im trying to create a "wobbling" effect with a bitmap
          Rod@FOF Level 1

          It somewhat depends on what the effect is intended to acheive.


          Here is a simple behavior script that can be applied to any bitmap. It wobbles, in the sense that it has a radom movement about its axis.


          That is acheived with the random() statements. The amount of wobble can be controlled by changing the value added to each parameter on each iteration.


          The last three statements keep the wobble from randomly walking off the frame. Again, wobble can be changed by setting the corrective value at which point the bitmap returns to its original state.


          Hope this helps.


          ------------------------------------------------------------------------------------------ -----------------

          property spritenum


          global glocH, gLocV, gRotation


          On beginsprite

            gloch = sprite(spritenum).loch
            gloch = sprite(spritenum).locv
            gRotation = integer(sprite(spritenum).Rotation)


          On enterframe


          b = random(2)
            if b=1 then
              sprite(spritenum).loch = sprite(spritenum).loch + random(2)
              sprite(spritenum).loch = sprite(spritenum).loch - random(2)
            end if
            c= random(2)
            if c=1 then
              sprite(spritenum).locv = sprite(spritenum).locV + random(2)
              sprite(spritenum).locv = sprite(spritenum).locV - random(2)
            end if
            d= random(2)
            if d=1 then
              Sprite(spritenum).rotation = sprite(spritenum).rotation + random(4)
              Sprite(spritenum).rotation = sprite(spritenum).rotation - random(4)
            end if
          if abs(gloch + sprite(spritenum).loch) <= 8  then sprite(spritenum).loch = gloch
          if abs(glocv + sprite(spritenum).locv) <= 8 then sprite(spritenum).locv = glocv
          if abs(Integer(gRotation - sprite(spritenum).Rotation)) >=8 then sprite(spritenum).rotation = gRotation