5 Replies Latest reply on May 22, 2006 10:15 PM by Newsgroup_User

    blend from 0 to 100

    FMF Assistans
      I am making a car game and when sprite 9 10 11 intersects with sprite 18 i whant this sprite to blend from 0 (invisible) to 100 (visible)

      so far i haw wrote lingo:

      on enterFrame me
      if sprite 18 intersects sprite 9 or 10 or 11 then
      sprite (the currentSpriteNum).blend = sprite (the currentSpriteNum).blend +100
      else
      sprite (the currentSpriteNum).blend = sprite (the currentSpriteNum).blend -100
      end if
      end


      but this only makeing the blend to go from 0 to 100 over and over again and do not interakt with the sprite that i want to.
        • 1. Re: blend from 0 to 100
          Level 7

          1) do you really want to blend or just appear/disappear ? since you
          change the value by 100, it's just like using visible property.

          2) you keep adding or retreiving value, higher or lower than 100 or 0,
          you should test the value to check if you still need to modify it

          3) your "if" statement isn't correct. It should be :
          if (sprite 18 intersects sprite 9) or (sprite 18 intersects sprite 10)
          or (sprite 18 intersects sprite 11) then

          i'd rather write :

          on enterframe me
          -- beware of ng line wrap
          if (sprite 18 intersects sprite 9) or (sprite 18 intersects sprite 10)
          or (sprite 18 intersects sprite 11) then
          if sprite (the currentSpriteNum).blend < 100 then
          sprite (the currentSpriteNum).blend = sprite (the
          currentSpriteNum).blend+10
          end if
          else
          if sprite (the currentSpriteNum).blend > 0 then
          sprite (the currentSpriteNum).blend = sprite (the
          currentSpriteNum).blend-10
          end if
          end if

          hth

          --
          -----
          Ned
          -----
          • 2. Re: blend from 0 to 100
            FMF Assistans Level 1
            It is still the same problem. the blend works for a second then right back to invisible.

            I am trying to make a life line, 3 hits and your dead. so i whant a square to go from unviseble to visible when i crash in to a enemy.

            maby there is a eseyer way?

            I hav the life in bakground from photoshop, is it eyser to make it as a button in flash?
            • 3. Re: blend from 0 to 100
              Level 7
              Piff_Puff a �crit :
              > It is still the same problem. the blend works for a second then right back to
              > invisible.

              did you try to change the increment / decrement value ? it's maybe just
              too fast

              try 1 instead of 10

              >
              > I am trying to make a life line, 3 hits and your dead. so i whant a square to
              > go from unviseble to visible when i crash in to a enemy.

              your "crash" is the intersection test, isn't it ? it happens at every
              frame, so the actual code should allow 10 "crashes" before dying, but if
              your movie goes at 20 fps they happen in a 1/2 second

              >
              > maby there is a eseyer way?

              I suggest that you first put a text field to display the "life" level,
              and adjust your code to see it what you want. Once your tests and
              "crashing" behavior will be ok, it'll be time to display it smarter.

              >
              > I hav the life in bakground from photoshop, is it eyser to make it as a button
              > in flash?

              is that another question ? because the actual one is programming
              related, it has nothing to do with what kind of media you use to show
              the life "level"


              hth
              --
              -----
              Ned
              -----
              • 4. Re: blend from 0 to 100
                FMF Assistans Level 1
                it worked when i put +99 insted of +100 because after 100 he started over.

                I now wounder how to get this blend to interakt with the 2 outers.

                I have one gren one yellow and one red, how can i tell them to start or stop blend after the first intersect withe outher sprites?

                like if the gren blend can tell the yellow blend to start when the gren has don his jobb?

                maby:
                if sprite (the currentSpriteNum has blend
                then
                sprite ( the sprite yellow start)
                end if
                end
                • 5. Re: blend from 0 to 100
                  Level 7
                  Piff_Puff a �crit :
                  > it worked when i put +99 insted of +100 because after 100 he started over.

                  that's what I'm talking about in part 2 of my first post

                  > I now wounder how to get this blend to interakt with the 2 outers.

                  As I already suggested, you should seperate the problem : have a global
                  variable storing the life level, that gets changed by your intersection
                  test, and call a global handler that displays the level.
                  In that handler, depending on the life level, you decide wich sprite you
                  blend.
                  That'll be far easier


                  --
                  -----
                  Ned
                  -----