Report as inappropriate.
Support world class that can be extended to make hexagonal worlds.
Control methods include:
* getInactiveFillColor() returns the inactive fill color (color of region outside the hexagonal area)
* setInactiveFillColor(Color) to change the background color of the world before the hexagons are drawn (for outside the hexagonal area)
* getHexBackgroundColor() returns the background color last set to all hexagons
* setHexBackgroundColor(Color) to change the background color of all the hexagons (for hexagonal area)
* getHexFrameColor() returns the frame color last set to all hexagons
* setHexFrameColor(Color) to change the color of the frames of all the hexagons
*setHexInactive(int, int) to change background and frame colors of the hexagon at the given hex coordinates to the inactive fill color
* setHexColors(Color, Color, int, int) to change the background and frame colors of the hexagon at the given hex coordinates
Helper methods include:
* isHexLocation(int, int) to test if the given hex coordinates are for a hexagon
* getWorldX(int, int) to get the world x-coordinate value of the center of the hexagon at the given hex coordinates
* getWorldY(int, int) to get the world y-coordinate value of the center of the hexagon at the given hex coordinates
* getHexWidth() to get the number of columns of hexagons in the world (like 'getWidth' for a grid world)
* getHexHeight() to get the number of rows of hexagons in the world (like 'getHeight' for a grid world)
* getHexSize() to get the size of the hexagons in the world (like 'getCellSize' for a grid world)
* addHexActor(Actor, int, int) to add an actor at the center of the hexagon at the given hex coordinates
Usage in this scenario: generation of the Fibonacci series using a triangle of hexagons.
The value of each hexagon is the sum of the one above and the one above and to the left. If no hexagon exists in either location, the value added to the sum is zero. If the result of the sum is zero, then the value defaults to one.
Click 'Run' to show the sums.
Click 'Pause' to highlight the long diagonal from top-left. The values in that diagonal are the values of the Fibonacci series (as are all diagonals going down and to the right starting from any top hexagon).
4981 views / 26 in the last 7 days
3 votes | 0 in the last 7 days
This scenario is a member of: Support Classes by danpost
Want to leave a comment? You must first log in.
2014/1/11