move loop

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 loop

Post by Samuele » Mon Jan 03, 2022 5:48 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: move loop

Post by jmburnod » Mon Jan 03, 2022 7:20 pm

Hi,
I played with your goal
stStartStopMove.zip
(1.11 KiB) Downloaded 184 times
Best regards
Jean-Marc
https://alternatic.ch

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

Re: move loop

Post by andresdt » 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/animationEngine
stStartStopMove.zip
(60.78 KiB) Downloaded 198 times
Be kind, we all have our own wars.
https://torocruzand.com/

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

Re: move loop

Post by dunbarx » Tue Jan 04, 2022 3:24 pm

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 160 times

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

Re: move loop

Post by andresdt » Tue Jan 11, 2022 2:36 pm

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

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

Re: move loop

Post by Samuele » Tue Jan 11, 2022 6:22 pm

thank you very much!
Samuele.

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

Re: move loop

Post by Samuele » Wed Jan 12, 2022 8:52 pm

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

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

Re: move loop

Post by richmond62 » Wed Jan 12, 2022 9:11 pm

do you know where can i learn more about this script?
Which script is that?

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

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

Re: move loop

Post by andresdt » Thu Jan 13, 2022 12:42 am

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

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

Re: move loop

Post by richmond62 » Thu Jan 13, 2022 9:08 am

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

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

Re: move loop

Post by Samuele » Fri Jan 14, 2022 2:19 am

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

Post Reply