Page 1 of 1

follow a graphic

Posted: Mon Jan 09, 2012 2:30 am
by DaveP
Hi Livecode Gurus,

I'm a new user to livecode, and hoping someone can point me in the right direction. I want to implement a 'follow' function that caters for intersecting. Say I have a card that has an image/graphic representing a wall. I can't run through the wall with my character so I user the intersect function to check where it is and handle it appropriately- simple enough. What I'm trying to do though is have an enemy chase my image - which again is simple enough using the loc of my image. But I'm having trouble in working out how the enemy can avoid the wall but still chase my character. If I use the intersect function again, I can stop the enemy before it hits the wall, but I can't work out how to best pick up the trail of my character and resume the chase.

Any tips would be appreciated!

Dave

Re: follow a graphic

Posted: Sun Jan 15, 2012 7:42 pm
by dunbarx
Not sure why, if you have your prey able to avoid the wall, the predator cannot as well. Wouldn't the same code be suitable for both?

In any case, how do you "chase"? Does the prey leave a trail of locs, stored perhaps in a custom property, that the predator follows?

Craig Newman

Re: follow a graphic

Posted: Sun Jan 15, 2012 8:02 pm
by sturgis
dunbarx wrote:
In any case, how do you "chase"? Does the prey leave a trail of locs, stored perhaps in a custom property, that the predator follows?

Craig Newman
I think the hilited part of the above might be a solution. Could have 2 modes. LInear follow, and an "out of the line of sight" method. Meaning, if you hit a wall, snoop for signs (IE a path of locs stored by the prey)