[blocks]
<when green flag clicked>
<forever>
<if><< <touching[ mouse pointer] <and><mouse down?> >>
<set{ drag }to( 1
<else>
<set{ drag }to( 0
<end>
<end>
[/blocks]
Try that script, it should work.
Offline
greenflash wrote:
[blocks]
<when green flag clicked>
<forever>
<if><< <touching[ mouse pointer] <and><mouse down?> >>
<set{ drag }to( 1
<else>
<set{ drag }to( 0
<end>
<end>
[/blocks]
Try that script, it should work.
I'd have to say, that was pretty smart, but thats when the sprite is clicked or hold-clicked on.
[blocks]
<when green flag clicked>
<forever>
<set{ x }to( <x position>
<set{ y }to( <y position>
<if><< <touching[ mouse pointer] <and> <mouse down?> >>
<wait until> << <not> <mouse down?> >>
<if> << << <not> <( <x position> <=> <{ x }> )> >> <or> << <not> <( <y position> <=> <{ y }> )> >> >>
<set{ drag }to( 1
<else>
<set{ drag }to( 0
<end>
<end>
<end>
[/blocks]
Phew! I hope that helps!
EDIT: Since you may not understand the jumble of scripts, I'll put it into code for you.
forever: set x to x position set y to y position if mouse down and touching mouse pointer: wait until not mouse down if not x = x position or y = y position: set drag to 1 else: set drag to 0
Last edited by Greatdane (2009-10-25 11:15:29)
Offline
Greatdane wrote:
greenflash wrote:
[blocks]
<when green flag clicked>
<forever>
<if><< <touching[ mouse pointer] <and><mouse down?> >>
<set{ drag }to( 1
<else>
<set{ drag }to( 0
<end>
<end>
[/blocks]
Try that script, it should work.I'd have to say, that was pretty smart, but thats when the sprite is clicked or hold-clicked on.
[blocks]
<when green flag clicked>
<forever>
<set{ x }to( <x position>
<set{ y }to( <y position>
<if><< <touching[ mouse pointer] <and> <mouse down?> >>
<wait until> << <not> <mouse down?> >>
<if> << << <not> <( <x position> <=> <{ x }> )> >> <or> << <not> <( <y position> <=> <{ y }> )> >> >>
<set{ drag }to( 1
<else>
<set{ drag }to( 0
<end>
<end>
<end>
[/blocks]
Phew! I hope that helps!
EDIT: Since you may not understand the jumble of scripts, I'll put it into code for you.Code:
forever: set x to x position set y to y position if mouse down and touching mouse pointer: wait until not mouse down if not x = x position or y = y position: set drag to 1 else: set drag to 0
Hmmm, yes. I tried greenflash's code and it only seem to detect whether it is clicked or not.
Offline
That's simple. Just replace the 'wait until not mouse down' with 'wait 0.1 secs'.
That should work.
(It's a tenth of a second it's dragged.)
Offline