Page 1 of 1

move objects

Posted: Sun Dec 19, 2021 11:22 pm
by Samuele
hi, is there a way to decide how fast objects should move? for example :

Code: Select all

set the location of button "bonus1000" to RandomLocation ()
or

Code: Select all

move me to RandomLocation ()
thanks

Re: move objects

Posted: Mon Dec 20, 2021 1:16 am
by dunbarx
Lots of ways to do this, but first go to the dictionary and read all about the "move" command. Then start experimenting with it. And make sure you not only move from one point to another in a certain specified time, but move along a list of points as well. Those points can be made in any way you like, by hand, or, say from a polygon graphic.

Craig

Re: move objects

Posted: Mon Dec 20, 2021 3:15 pm
by richmond62
check moveSpeed

Re: move objects

Posted: Mon Dec 20, 2021 3:20 pm
by dunbarx
What Richmond said, but note that if you set an explicit time for your move, the moveSpeed property has no effect. You cannot do both.

Craig

Re: move objects

Posted: Mon Dec 20, 2021 3:50 pm
by Newbie4
If you do not use the moveSpeed, you can set the "time" in the move command

Code: Select all

move button "box"  to 100,100 in 5 secs
more examples at https://sites.google.com/a/pgcps.org/li ... -and-paths

Re: move objects

Posted: Tue Dec 21, 2021 1:58 pm
by Klaus
I may repeat myself, but also this can be found in the Dictionary under "Move"! 8)

Samuele, we have been there already, right?
If you keep "forgetting" about the dictionary, send a note to yourself!

Re: move objects

Posted: Tue Dec 21, 2021 4:32 pm
by andresdt
you might want to take a look at https://github.com/derbrill/animationEngine

Code: Select all

aeMoveTo the long id of control, randomLoc(), tTime, tEffect  

Re: move objects

Posted: Sun Jan 02, 2022 3:50 pm
by Samuele
sorry i've not been clear this is the script that moves

Code: Select all

on MoveMe0
   put 1 into _gonAndOff
  set the location of button "bonus1000" to RandomLocation ()  
   send MoveMe0 to me in 0.50 seconds

   put the result into _gmoveMePendingMethodID
   
end MoveMe0

and this is the script that stops the moving

Code: Select all

on StopMoveMe
   lock screen
   cancel _gmoveMePendingMethodID
end StopMoveMe
if i change it to "move button to" it's not gonna stop.
So my question is if there's a better way to do this ⬆︎?
thanks!
maybe I've made myself more clear on this post viewtopic.php?f=7&t=36601