I'm making a hex grid for our project using as3. I wonder why my hex grid isn't tiling properly. Running my code within Flash CS6 produces seamless tiling https://i.sstatic.net/ZTQAl.png but on FlashDevelop it looks like this https://i.sstatic.net/td3ke.png
Here is my code (in FlashDevelop):
public class PlayState extends FlxState { private var player:PlayerSprite; private var hexMap:GenerateGrid; protected var hexagonWidth:int = 128; protected var hexagonHeight:int = 132; protected var hexagonNumber:Number = 0; protected var gridX_Size:int = 7; protected var gridY_Size:int = 10; public function PlayState() { } override public function create():void { FlxG.mouse.show(); for (var yPos:int = 0; yPos < gridY_Size; yPos++) { for (var xPos:int = 0; xPos < gridX_Size; xPos++) { var hexagonX_Pos:Number = hexagonHeight * xPos + (yPos % 2) * hexagonWidth / 2; var hexagonY_Pos:Number = hexagonHeight * yPos / 4 * 3; hexagonNumber = xPos + yPos * gridX_Size; hexMap = new GenerateGrid(hexagonX_Pos - hexagonWidth, hexagonY_Pos - hexagonHeight); this.add(hexMap); } }
And for the class where the hex tiles are drawn
public class GenerateGrid extends FlxSprite { [Embed(source = "../res/hextile_grass.png")] private var HexGrassPng:Class; public function GenerateGrid(X:Number = 0, Y:Number = 0):void { super(X, Y); var hex:FlxSprite = new FlxSprite(); hex = loadGraphic(HexGrassPng, false, false); hex.x = X; hex.y = Y; } override public function update():void { //super.update(); } }
Any help would be greatly appreciated.