4 Replies Latest reply on May 29, 2007 4:46 AM by James Newton, ACP

    Sprite quad

    smartino Level 1
      hi,

      I'm setting a sprite a certain quad value. This works fine but when i try and resize the sprite through code in the same behaviour the sprite never resizes?!? i'm using the .width and .height when resizing but no effect. when I comment out the sprite(theSprite).quad = myQuadValues the resize code works?

      thanks in advance for any help.

      Simon.
        • 1. Re: Sprite quad
          Level 7
          As you've observed, you need to use one or another. Once you've
          "quadded" your sprite you need to continue with altering the quad
          instead of the rect.
          • 2. Re: Sprite quad
            James Newton, ACP Level 3
            Try this:
            puppetSprite <integer spriteNum of quadded sprite>, FALSE

            You should now be able to resize the sprite through code again.
            • 3. Re: Sprite quad
              smartino Level 1
              I've given the puppetSprite a go and this works, but the sprite changes back to it's original size once I turned puppetsprite to false?!?
              I'm slightly confused to why this is happening. I have the sprite(me.spriteNum).quad = pQuad on a mouseUp and the line below I have the puppetSprite to false and this is when the sprite returns back to it's original size.
              • 4. Re: Sprite quad
                James Newton, ACP Level 3
                I may have misunderstood your aim. It now seems that you want to retain the quad shape of the sprite, but change its size. If that is the case, then you will need to calculate a new quad.

                The puppetSprite trick is to remove the influence of the quad from the sprite.

                Note that you can set the .flipH, .flip, .skew and .rotation of a sprite without setting its quad. If you do this, you setting the rect of the sprite still works. The drawback is that you can only create parallelograms this way: you must set the .quad of the sprite if you want to create an arbitrary quadrilateral shape.