move objects

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

move objects

Post by Samuele » Sun Dec 19, 2021 11:22 pm

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
Samuele.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: move objects

Post by dunbarx » Mon Dec 20, 2021 1:16 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10098
Joined: Fri Feb 19, 2010 10:17 am

Re: move objects

Post by richmond62 » Mon Dec 20, 2021 3:15 pm

check moveSpeed

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: move objects

Post by dunbarx » Mon Dec 20, 2021 3:20 pm

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

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: move objects

Post by Newbie4 » Mon Dec 20, 2021 3:50 pm

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
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: move objects

Post by Klaus » Tue Dec 21, 2021 1:58 pm

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!

andresdt
Posts: 156
Joined: Fri Aug 16, 2019 7:51 pm
Contact:

Re: move objects

Post by andresdt » Tue Dec 21, 2021 4:32 pm

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  
Be kind, we all have our own wars.
https://torocruzand.com/

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: move objects

Post by Samuele » Sun Jan 02, 2022 3:50 pm

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
Samuele.

Post Reply