moving object continues to move after "go to card"

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

moving object continues to move after "go to card"

Post 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 601 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
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post 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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

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

Post 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
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

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

Post 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
Post Reply