8 Replies Latest reply on Dec 1, 2006 3:01 AM by duckets

    Blub

    Lakerol
      I'm making a lava-thing. This is a bubble going up and down quite slowly, and when it is about to hit the bottom or top, it becomes more flat. When it has hit the bottom or top, it reforms to its original shape.

      I already have this, but it's not quite what I want, anybody any ideas?

      Global gDV

      on beginSprite
      gDV = 1
      end

      On exitframe
      Sprite (1).locV = sprite(1).locV +gDV

      If sprite(1).locV > 400 OR sprite(1).locV < 0 then
      gDV = gDV * -1
      end if

      if sprite(1).locV >360 AND sprite(1).locV<390 then
      Member(1).moveVertex(1,-3,0)
      Member(1).moveVertex(2,3,0)
      Member(1).moveVertex(3,3,0)
      Member(1).moveVertex(4,-3,0)
      end if
      end
        • 1. Re: Blub
          Lakerol Level 1
          Is it possible to let Director change the Vertex's until the circle has reached a certain width?
          • 2. Re: Blub
            duckets Level 1
            quote:

            Originally posted by: Lakerol
            I'm making a lava-thing. This is a bubble going up and down quite slowly, and when it is about to hit the bottom or top, it becomes more flat. When it has hit the bottom or top, it reforms to its original shape.
            I already have this, but it's not quite what I want, anybody any ideas?



            Maybe if you told us what you do want, someone might be able to help you!

            - Ben

            • 3. Re: Blub
              duckets Level 1
              quote:

              Originally posted by: Lakerol
              Is it possible to let Director change the Vertex's until the circle has reached a certain width?


              You could check the member's width property:

              if member(1).width < 80 then
              ... your vertex changing code here
              end if

              hope this helps!

              - Ben

              • 4. Re: Blub
                Lakerol Level 1
                I thought it would be understandable.. I'll try to explain it again..
                This thing is based on a lavalamp
                So it starts of with a circle filled with a solid color, which starts from the bottom
                Then it goes slowly up, and when it's about to hit the top, the circle becomes more flat, oval almost.
                Then when it has eventually hit the top, it goes back down again, reforming to its orginial shape (circle) and the same happens when hitting the bottom..

                Maybe this is more clear
                • 5. Re: Blub
                  Lakerol Level 1
                  Thanks Ben.

                  Now I have this code:
                  Global gDV

                  on beginSprite
                  gDV = 1
                  end

                  On exitframe
                  Sprite (1).locV = sprite(1).locV +gDV
                  If sprite(1).locV > 390 OR sprite(1).locV < 0 then
                  gDV = gDV * -1
                  end if

                  if sprite(1).locV >365 AND sprite(1).width<110 then
                  member(1).moveVertex(1,-1,0)
                  member(1).moveVertex(2,1,0)
                  member(1).moveVertex(3,1,0)
                  member(1).moveVertex(4,-1,0)
                  end if
                  end

                  So the bubble becomes more and more oval, until it has reached the 110 width. But I can't figure out how to make it resize to its original shape...

                  I tried to add this:

                  if sprite(1).width>105 then
                  member(1).moveVertex(1,1,0)
                  member(1).moveVertex(2,-1,0)
                  member(1).moveVertex(3,-1,0)
                  member(1).moveVertex(4,1,0)
                  end if

                  But of course this doesn't work...
                  • 6. Re: Blub
                    duckets Level 1
                    I think you'll need to check whether the sprite has moved back beyond a certain distance too (as in your other line). Perhaps something like:

                    if sprite(1).locV < 20 AND sprite(1).width>105 then

                    hope this helps!

                    - Ben
                    • 7. Re: Blub
                      Lakerol Level 1
                      Thanks Ben.. But now I have something like this:
                      if sprite(1).locV > 20 AND sprite(1).width>105 then
                      -- conditions to change the vertex
                      end if
                      So indeed, the circle becomes more oval when it hits the bottom, but it has to become back round when floating back up.. I have no idea how to do this...


                      • 8. Re: Blub
                        duckets Level 1

                        You have used > 20 instead of < 20.

                        I put < 20 to mean 'near the top of the screen'. You can of course change the value to whatever you want.

                        - Ben