0 Replies Latest reply on May 9, 2013 11:45 PM by anjemalo

    Drag and back to original position

    anjemalo Level 1

      Hello:

      I have a button that I drag and when I release it I need to get back to its original position in a smooth way and when intersects a sprite I put a property to true to make something. I have write the below code but does not work well. Can you help me please?

       

      property activo

      property splocH,sp,pPressed

      On MouseDown me

        pPressed=True

        if Activo then

          put "play"

        else

          put "don't play"

        end if

      end

       

      on mouseUp me

        pPressed=False

      end

      on mouseUpOutside me

        pPressed=False

      end

       

      on BeginSprite me

        pPressed=False

        sp=sprite(me.spritenum)

        splocH=sp.locH

      end

       

      on exitframe me

        if pPressed=True then

          IF sprite 2 intersects 4 then

            Activo=True 

            member("texto").text="activo"

          Else

            Activo=False

            member("texto").text="no activo"

          end if

        end if

        if Sprite(2).locH>=splocH then

          Sprite(2).locH=Sprite(2).locH-10

        end if

      end