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

Click in polygon

Post by Da_Elf » Thu Nov 06, 2014 9:34 pm

Most things ive seen on this are old and i wasnt sure if i should necropost
I tried this

Code: Select all

on mouseUp
   if within(grc "Polygon", the clickLoc) then
      answer the clickLoc
   end if
end mouseUp
thing is it seems to be using the rectangle border of the shape rather than the inside are of the polygon shape. Did something change? what am i doing wrong

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 » Thu Nov 06, 2014 9:39 pm

Hi Da_Elf,
Try setting the polygon to opaque.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Click in polygon

Post by Da_Elf » Thu Nov 06, 2014 9:45 pm

i put it to opaque and i clicked fill. its still using the rectangle area and not just the internal area of the shape

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 » Thu Nov 06, 2014 9:50 pm

I must not be understanding
click_poly.zip
LC 6.6.1
(520 Bytes) Downloaded 250 times
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Click in polygon

Post by Da_Elf » Thu Nov 06, 2014 9:55 pm

ah. i had read somewhere to turn on fill. that was my problem

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

Re: Click in polygon

Post by Da_Elf » Thu Nov 06, 2014 9:57 pm

my other problem was the shape was selected

last question. i just want the area to be a guide but i dont want to see the area. when i hide the shape it no longer works

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 » Thu Nov 06, 2014 10:01 pm

Does setting it's blendLevel to 99 work for you?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Click in polygon

Post by dunbarx » Thu Nov 06, 2014 10:01 pm

Hi.

The enclosing rect of an irregular object does not trigger a "mouseUp" message, even if grouped. Simon has answered another aspect of this issue, but that solution is for the interior. Can you send off your stack?

Craig Newman

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

Re: Click in polygon

Post by Da_Elf » Thu Nov 06, 2014 10:05 pm

actually putting the blend to 100 worked well. didnt even think of that.

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

Re: Click in polygon

Post by Da_Elf » Thu Nov 06, 2014 10:46 pm

Was wondering if i could use livecode to build games like something like this
http://www.adventuregamestudio.co.uk/
i might be biting off more than i can chew

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 » Thu Nov 06, 2014 10:54 pm

Hi Da_Elf,
Sure you can;
http://en.wikipedia.org/wiki/Myst
I forget which blend of Hypercard that was made with.

Really, the hard part is the graphics (for us programmers).

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Click in polygon

Post by Da_Elf » Fri Nov 07, 2014 2:23 pm

One of my degrees is actually in animation so the graphics wouldnt be too much of a problem. what i would find tricky which AGS has programmed into it is if i you started a character at the top of a U shaped bounding area that when you click the top of the other top of the U that the "characters movement would be to move down across then back up rather than point A to point B and avoid obstacles. Obviously a lot of work went into building the AGS engine so i know it would be a tough thing.

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 » Fri Nov 07, 2014 6:33 pm

Hi Da_Elf,
Do you mean "follow a path"?
move to the points of grc "Polygon"
does that.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Click in polygon

Post by Da_Elf » Sat Nov 08, 2014 10:13 pm

not follow a path. if i have an item to move from point A to point B but i have lets say a rectangle inbetween the points it would have to walk around the rectangle and not take a straight line

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 » Sat Nov 08, 2014 10:36 pm

Hi Da_Elf,
The path does not have to be straight. Go ahead and use the freehand polygon tool and draw any line you want.
Now if you are talking about the avatar(?) recognizing that there may or may not be a block in front of it then there is more programming.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply