Am Mittwoch den, 21. August 2002, um 09:04, schrieb Elvin M. Certeza, Jr.:
> Say, I want to move an object/image 50 pixels. over .. say 6 seconds? Try this behavior: property pStart, pEnd, pCurrTime, pTimer property pSprite, pNewPos, pDirVector on beginsprite me pSprite = sprite(me.spritenum) pStart = pSprite.loc -- Startlocation = Location of the sprite pEnd = point(endX,endY) -- Your endposition of the sprite pCurrTime = yourSeconds * 60 -- The time needed in 1/60th seconds pTimer = the timer -- Current timer pDirVector = pEnd - pStart -- Calculate the direction of the sprite as a vector end on exitframe me if pNewPos = pEnd then exit -- Pass this event after endposition is reached myTimeStep = min(the timer - pTimer, pCurrTime) -- recalculate the time for the steps needed pNewPos = pStart + (pDirVector * myTimeStep / pCurrTime) -- calculate new postion based on poor math pSprite.loc = pNewPos -- set the sprite to the new location end This behavior will move the sprite over a specific time to a new position. Based on your framerate, the animation is clumsy or smooth. This script can be enhanced with a getPropertyDescriptionList, but I was to lazy ;-) Thomas [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/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!]
