I'm not sure I understand exactly what you want, as it appears aspects of 
your script conflict. If your sprite travels 1 pixel at a time, you can't 
speed up a repeat loop beyond removing a delay. So, the first thing I 
would do is remove all your delay detail.

>on mouseUp me
> repeat with y=883 down to 583 
>    sprite(pspriteNum).locV = Y
>    updateStage
>  end repeat
>end 

This will prevent all these lines from being executed the 300 times 
you've requested.

Beyond that, you can speed things up by moving more than one pixel at a 
time. Here is a quick handler that will probably accompish everything. 
NOTE: I HAVE NOT TESTED THIS

property pSpriteNum

on beginSprite me
  pSpriteNum = me.spriteNum
end

on mouseUp me
  speedAnim me, 883, 583, "down", 3, 0
end

on speedAnim me, startPos, endPos, upOrDown, speedFactor, delayFactor
  sprite(pSpriteNum).locV = startPos
  increm = (abs(startPos) - abs(endPos))/speedFactor
  repeat with y= 1 to increm
    if upOrDown = "up" then
      sprite(me.SpriteNum).locV = sprite(pSpriteNum).locV + speedFactor
    else
      sprite(me.SpriteNum).locV = sprite(pSpriteNum).locV - speedFactor
    end if
    put the ticks into delayTime 
    repeat while the ticks < delayTime + delayFactor
    end repeat
    updateStage
  end repeat
  sprite(pSpriteNum).locV = endPos
end


speedAnim me, startPos, endPos, upOrDown, speedFactor, delayFactor

This may appear overly compicated, but it's just flexible. It says, 
beginning with start and end positions, determine a number of increments 
necessary to move the sprite base on more than 1-pixel per move. That is, 
you first asked for 300 pixles. With a speed factor of 1, it will move 
300 pixels. With a speed factor of 2, it will move (883-583)/2 = 150 
times, etc. In the event you wanted to slow down the animation instead of 
speed it up, you can leave speedFactor at 1, and increase delayFactor.

I added the endPos outside the repeat loop in case the increment caused 
the final position to be a pixel or two off.

I also added the upOrDown adding flexibility to move... uh... up or down. 
You could easily change sprite movement to .loc instead of .locV allowing 
horizontal or angular movement, too. I didn't want to go crazy since I 
didn't want to complicate matters and I didn't have Director open (or 
time) to test it.

If something doesn't make sense, let me know.

Rich

On 2/14/01 12:14 PM, R Kumar ([EMAIL PROTECTED]) sent:
>I am moving a sprite from point A to Point B. I need
>to speed up the time in which it reaches from point A
>to Point B. I am able to reduce the time but not able
>to increase the speed. Any help would be appreciated.
>
>ravi
>
>on mouseUp me
> repeat with y=883 down to 583 
>    sprite(pspriteNum).locV = Y
>    put the ticks - 1 into delayTime 
>    repeat while the ticks < delayTime 
>    nothing  
>    end repeat
>    updateStage
>  end repeat
>end 

[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