Page 1 of 1

move loop

Posted: Mon Jan 03, 2022 5:48 pm
by Samuele
Hi, I'm trying to create a move loop that moves objects in a loop until something happens and then the moving stops, I tried doing that like this
MOVING:

Code: Select all

on MoveMe
   move button "something" to RandomLocation ()
   send MoveMe1 to me in 1 second
   put the result into _gmoveMePendingMethodID
end MoveMe
and STOPPING:

Code: Select all

on StopMoveMe
   lock screen
   cancel _gmoveMePendingMethodID
end StopMoveMe
but the moving continues even after the StopMoveMe kicks in
So to conclude my question is how to stop the moving OR how to create a better Move loop that actually stops :roll:
thanks!

Re: move loop

Posted: Mon Jan 03, 2022 7:20 pm
by jmburnod
Hi,
I played with your goal
stStartStopMove.zip
(1.11 KiB) Downloaded 184 times
Best regards
Jean-Marc

Re: move loop

Posted: Mon Jan 03, 2022 9:23 pm
by andresdt
Well in the other post I suggested you use the animationEngine library created by derbrill :D . It is dual-licensed.
Look at the stack that I share with you, I think something like that is what you want to achieve

https://github.com/derbrill/animationEngine
stStartStopMove.zip
(60.78 KiB) Downloaded 199 times

Re: move loop

Posted: Tue Jan 04, 2022 3:24 pm
by dunbarx
Not sure what you are really after with all these "move" issues. Attached is a stack that demonstrates a "random walk", that is, a loop with movement in a random direction for a random distance. I am not sure this is perfectly executed here, but it might give you some ideas. Everything is in a short script of button "start". A true random walk ought never wander too far from the starting point.

You can reset by pressing "start' again, and stop with the optionKey.

Craig
RandomWalk.livecode.zip
(902 Bytes) Downloaded 161 times

Re: move loop

Posted: Tue Jan 11, 2022 2:36 pm
by andresdt
In the buttons "something 1" and "something 2" of the stack that I shared, you will find the following script.

Code: Select all

on aeMoveDone
      aeMoveTo the long id of me, randomLocation (), 1000
end aeMoveDone
This is what allows the movement to be infinite. Since the object completes one movement, another will immediately begin.

Maybe I should have clarified this in my post. So i apologize for that :oops:

Re: move loop

Posted: Tue Jan 11, 2022 6:22 pm
by Samuele
thank you very much!

Re: move loop

Posted: Wed Jan 12, 2022 8:52 pm
by Samuele
andresdt wrote:
Mon Jan 03, 2022 9:23 pm
Well in the other post I suggested you use the animationEngine library created by derbrill :D . It is dual-licensed.
Look at the stack that I share with you, I think something like that is what you want to achieve

https://github.com/derbrill/animationEnginestStartStopMove.zip
do you know where can i learn more about this script? because i'm interested in animation in livecode.
thanks

Re: move loop

Posted: Wed Jan 12, 2022 9:11 pm
by richmond62
do you know where can i learn more about this script?
Which script is that?

https://www.dropbox.com/sh/boxujwg27bv1 ... EbKGa?dl=0

Re: move loop

Posted: Thu Jan 13, 2022 12:42 am
by andresdt
In the repository https://github.com/derbrill/animationEngine look at the PDF file animationEngine6_manual.pdf. When I go to make an animation I use that PDF and the animationEngine6 library

Thanks @richmond62 for sharing that

Re: move loop

Posted: Thu Jan 13, 2022 9:08 am
by richmond62
If you click on the DropBox URL I posted above you can download 10 stacks
that exhibit several different ways to ANIMATE in a very simple fashion.
-
Screen Shot 2022-01-13 at 10.06.47 AM.jpg

Re: move loop

Posted: Fri Jan 14, 2022 2:19 am
by Samuele
thank you very much to all!!, now there's just studying :lol:
to know, do i need to put all the script of this animation stack on my stack or can i put only the pieces that interest me?
thanks again