>Is it possible to drag a sprite and then when you release the mouse the

>sprite will return to its original position?
>I know how  to drag them but not return it to the position.

if you want to move it back (step by step),
you could use this behavior for the sprite.



property mySprite
property speed, destination

on beginSprite me
  mySprite = sprite(me.spriteNum)
  destination = point (200,200)
  speed = 4
end beginSprite me

on mouseUp me
  moveMe
end  mouseUp me

on moveMe
  x0 = mySprite.locH
  y0 = mySprite.locV
  deltaX = destination.locH - x0
  deltaV = destination.locV - y0
  stepCount = (sqrt ((deltaX * deltaX) + (deltaV * deltaV)) /
speed).integer
  repeat with i = 1 to stepCount
    percent = 1.0 * i / stepCount
    newPoss = point (x0 + deltaX * percent, y0 + deltaV * percent)
    mySprite.loc = newPoss
    updateStage
  end repeat
end moveMe

Ralf.


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to