1 Reply Latest reply on Sep 8, 2006 7:51 AM by Newsgroup_User

    putting sprite relatively

    mohsena
      hello all ,would you please show me a way to put a sprite relative to another sprite on the stage(for example sprite a reside 5 mm to the sprite b on the stage ,when the sprite a change ,the sprite b does not change relative to the sprite a) ?( would you please introduce me a tutorial or sample abut this case)
      Sincerely yours Mohsena
        • 1. Re: putting sprite relatively
          Level 7
          Just use locH and/or locV. Something like:

          on beginSprite me
          Horizontal_Offset = 20 -- change to whatever you want
          Vertical_Offset = 20 -- change to whatever you want
          sprite(the currentSpriteNum).locH = sprite(the currentSpriteNum +
          1).locH + Horizontal_Offset
          sprite(the currentSpriteNum).locV = sprite(the currentSpriteNum +
          1).locV + Vertical_Offset
          end

          Just remember that the locH and locV are based on what you define as the
          centroid of the member being moved, which will be the member's center
          unless you physically change it. So the x,y numbers you see when you
          click on the sprite aren't the ones you're working with. Average those
          numbers, and that's the locH and locV you're basing your calculations on.