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??



Piccolo2D Developers Group:

Reply via email to