follow a graphic

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
DaveP
Posts: 1
Joined: Mon Jan 09, 2012 2:09 am

follow a graphic

Post by DaveP » Mon Jan 09, 2012 2:30 am

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

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

Re: follow a graphic

Post by dunbarx » Sun Jan 15, 2012 7:42 pm

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

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: follow a graphic

Post by sturgis » Sun Jan 15, 2012 8:02 pm

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)

Post Reply