Click in polygon

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

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Click in polygon

Post by Da_Elf »

yes lots of programming. If it knows where it starts. it knows where it ends. but it can not pass through objects in its way with no predefined path then it will be tonnes of coding
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Click in polygon

Post by Simon »

Not tons!
If it's objective is to get from the left of the screen to the right with a box in the center then when the avatar hits the box it can be as simple as;

x- 1 --back away from box
y + 1 --move down
x+ 1 --hits box? if yes repeat the above

Now if the box is a U on it's side and the avatar walks into it then it does get more complicated. But I didn't get the impression that the link you posted was to a game but a moving storybook? Maybe I have it all wrong?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Click in polygon

Post by [-hh] »

Hi all,

Da_Elf, Simon's current answer/solution is better for your problem.

But to let you know that it is not your fault that your first script didn't work:
With LC 6.6.5 this would have worked "closely", with LC 6.7 to 7.0 it currently reports more than half of cases wrong.
See my post in ( http://forums.livecode.com/viewtopic.php?f=7&t=22042 ).
shiftLock happens
Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Click in polygon

Post by Da_Elf »

the link i gave was to a game engine for making one of the old school point and click adventure games like kings quest. The movement of the character in their engine uses an AI system so things like walking into a U wouldnt happen. In my little search on google im coming across some pathfinding tutorials but they are for different coding platforms. Going to jump into reading some of this tomorrow
http://bjoernke.com/?target=games
Post Reply