Page 1 of 2

Click in polygon

Posted: Thu Nov 06, 2014 9:34 pm
by Da_Elf
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

Re: Click in polygon

Posted: Thu Nov 06, 2014 9:39 pm
by Simon
Hi Da_Elf,
Try setting the polygon to opaque.

Simon

Re: Click in polygon

Posted: Thu Nov 06, 2014 9:45 pm
by Da_Elf
i put it to opaque and i clicked fill. its still using the rectangle area and not just the internal area of the shape

Re: Click in polygon

Posted: Thu Nov 06, 2014 9:50 pm
by Simon
I must not be understanding
click_poly.zip
LC 6.6.1
(520 Bytes) Downloaded 251 times
Simon

Re: Click in polygon

Posted: Thu Nov 06, 2014 9:55 pm
by Da_Elf
ah. i had read somewhere to turn on fill. that was my problem

Re: Click in polygon

Posted: Thu Nov 06, 2014 9:57 pm
by Da_Elf
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

Re: Click in polygon

Posted: Thu Nov 06, 2014 10:01 pm
by Simon
Does setting it's blendLevel to 99 work for you?

Simon

Re: Click in polygon

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

Re: Click in polygon

Posted: Thu Nov 06, 2014 10:05 pm
by Da_Elf
actually putting the blend to 100 worked well. didnt even think of that.

Re: Click in polygon

Posted: Thu Nov 06, 2014 10:46 pm
by Da_Elf
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

Re: Click in polygon

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

Re: Click in polygon

Posted: Fri Nov 07, 2014 2:23 pm
by Da_Elf
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.

Re: Click in polygon

Posted: Fri Nov 07, 2014 6:33 pm
by Simon
Hi Da_Elf,
Do you mean "follow a path"?
move to the points of grc "Polygon"
does that.

Simon

Re: Click in polygon

Posted: Sat Nov 08, 2014 10:13 pm
by Da_Elf
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

Re: Click in polygon

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