Page 1 of 1

moving object continues to move after "go to card"

Posted: Mon Nov 02, 2015 10:13 pm
by sms5138
Hi everyone,

I'm trying to make a top down game where the user moves the character by tapping the screen and the character moves to that locations... I've attached a copy to better show the issue i'm experiencing...
game - Copy.livecode.zip
(146.07 KiB) Downloaded 475 times
I have it set for the character to start in a specific location depending on if it is moving from room 1 to room 2 or vice versa...

When the character transitions from room 1 to room 2 the character will start from the position i've determined as the starting location, but then proceeds to move to the last clicked location from the other card...

To make it a bit more confusing... it doesn't always do this, and seems to work perfect for a short while... then it seems to revert back to the previous cycle of continuing to move like before...

Any advice or resources that you can provide would be greatly appreciated... I'm pretty stumped on this one...

thank you in advance for any insight you can provide!

-Sean

Re: moving object continues to move after "go to card"

Posted: Tue Nov 03, 2015 4:23 am
by Simon
Hi Sean,
Man I'm getting old... this took way too long to solve.

Code: Select all

  ... send "moveHero" to me in 20 millisec
end openCard

on moveHero
         move group "hero" to 821,266
end moveHero
The trick here is that if liveCode gets a second move command while doing a move command it stops the old one and starts the new one. You can get rid of set loc.

Simon

Re: moving object continues to move after "go to card"

Posted: Fri Nov 06, 2015 3:09 pm
by sms5138
Hi Simon,

Thank you for your help on this! I'll give a shot when as soon as i get a chance, and report back!

Thanks again!

-Sean

Re: moving object continues to move after "go to card"

Posted: Mon Nov 16, 2015 5:01 pm
by sms5138
It took me longer to get back than i'd anticipated, but it looks like that seems to have solved the issue.

Thank you again for your help!

-Sean