View Full Version : [help] how to move a object by step-by-step
westoy
06-08-2006, 01:19 AM
I'm trying to move a image object to another y-position when page loaded, but I can not move it to the target position by step-by-step , it always moved to there at once time :o . can you guys give me some helps? or give me a simply example and i'll try to learn it by myself.
thx anyway !
btw, I have download some example here , to try to learn it by myself , but I can not understand your example , not meaning the example are not good, it's just ... my poor english can not help me more at that.
Best Regards !
yosik
06-08-2006, 07:31 AM
Way back ( I don't remember who) a ballbouncing project was posted. Here it is.
Check the onTimer actions which call upon a global function.
Good luck
Yossi
holtgrewe
06-09-2006, 11:47 AM
Assuming your step-by-step loop is correct, could you be missing an Application.Sleep(50); within the loop (slow down the move a little).
I don't see any of your code posted so I can't see exaclty what you're doing.
cheers.
Here are a couple more examples of how to move objects:
http://www.indigorose.com/forums/showthread.php?t=16287
http://www.indigorose.com/forums/showthread.php?t=15675
Both examples use the 'On Timer' event to faciliate the move. To create basic movements you'll need define the following:
1) Object to be moved
2) Starting X,Y position
3) Target X,Y position
4) Number of pixils to move per timer event
5) Interval for the timer event
Once you have these defined, start the page timer in the 'On Timer' event:
1) Get the current position of the object
2) Check that against the target position
3a) If the are the same, stop the timer
3b) If they are different, calculate your object's next position (step) and move it
You'll want to play with the number of pixils per move and timer interval to get the motion speed/smoothness just the way you want.
Hope this helps. BTW, you might want to be conservative using the Application.Sleep() as it can be a little taxing on performance.
http://www.indigorose.com/forums/showthread.php?t=13278
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.