Hi, Robert,

When you rotate a PImage, you are saying it is getting "squared" --
meaning that it will get picked if the LOS clips the corner, even if
the rotated image isn't covered.

But PImages should rotate and get picked correctly. Are you not
finding that to be the case? If the problem is that Piccolo2D simply
isn't acknowledging transparency when picking is happening, then
probably the best solution is to create a PImage class that does know
about transparency.

Looks like a very interesting thing you're creating, btw.

-- Aaron


On Mon, Mar 12, 2012 at 4:24 AM, Robert Kovacs <rsksmi...@gmail.com> wrote:
> Thanks Aaron for your interest!
>
> I have managed to "solve" the problem but I am not totally happy.
>
> I have put some code snippets and screen shots in the attached word doc.
>
> Rob
>
>
> On 11 March 2012 22:06, Aaron Dixon <atdi...@gmail.com> wrote:
>>
>> Rob,
>>
>> Can you clarify your problem a little bit more? Some (short snippets
>> of) code might help.
>>
>> How are you picking the nodes along the line of sight? Are you using
>> Piccolo intersects() methods or doing something else?
>>
>> Aaron
>>
>> On Tue, Mar 6, 2012 at 10:07 AM, Robert Kovacs <rsksmi...@gmail.com>
>> wrote:
>> > Dear all,
>> >
>> > first off the problem I have is not caused by a bug with Piccolo2d. It
>> > is
>> > related to a game that I am writing using Piccolo 2d.
>> >
>> > Let me explain:
>> >
>> > 1. I have a map board made up of hexagons  - each hexagon being a PPath
>> > with
>> > additional child PPaths for the terrain within the hexagon.
>> > 2. I need to verify a Line Of Sight between hexagons. To do this I am
>> > taking
>> > the centre point of the from and to hexagons and using a line
>> > calculation
>> > algorithm picking the nodes in between.
>> >
>> > This works fine with PPath nodes as the picking works a dream.
>> >
>> > The problem comes when I add an image, for a building. The picking works
>> > fine if the PImage is rectangular and is not rotated. However I do have
>> > non
>> > rectangular buildings which are rotated. This means that the picking
>> > will
>> > pick the building PImage when there is no building at that actual point.
>> >
>> > I have implemented a halfway solution whereby I create a BufferedImage
>> > of
>> > the view and trace a line from start to end point. As the building
>> > images
>> > are transparent me getPixel function checks for non transparent colours
>> > and
>> > reports an obstacle.
>> >
>> > - This sort of works ok but has been a right muddle to implement due to
>> > transposing the start and end points on the screen to the BufferedImage.
>> > - Also this only works when checking the LOS of the on screen visible
>> > portion of the map.
>> >
>> > What I was wondering was .... has anyone got any ideas/ suggestions?
>> >
>> > I have thought of creating a PPath around the building and using that
>> > when
>> > picking making the image layer invisible at the moment of picking - Are
>> > there any other ideas??
>> >
>> > Thanks
>> >
>> > Rob
>> >
>> > --
>> > Piccolo2D Developers Group:
>> > http://groups.google.com/group/piccolo2d-dev?hl=en
>>
>> --
>> Piccolo2D Developers Group:
>> http://groups.google.com/group/piccolo2d-dev?hl=en
>
>
> --
> Piccolo2D Developers Group:
> http://groups.google.com/group/piccolo2d-dev?hl=en

-- 
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to