Hi everybody, I’m an amateur developer trying to learn Haxe, I will use this blog to document my progress customizing and improving a tower defense game. Feel free to comment, join and help in this process and remember that the goal of this project is learning and help others learn and put their feet wet into Haxe and Openfl, for that reason, if you are an experienced developer with much experience in haxe please document everything you suggest for people who are learning.
You can add your ideas and comments in this forum
Let’s start with the idea. I love tower defense games so I decided to fork and compile the tower defense demo from http://haxeflixel.com/demos/MinimalistTD to learn to develope with haxe,
Play the game here: http://lingoworld.eu/websites/games/minimalisttd
The first issues I experienced to compile this project were seting up and installing Haxe, Neko and openFL.
I found that the versions of Haxe and Neko that comes from official Ubuntu repository seems to be incompatible (by default installs haxe 3.2. and neko 2.1.) It seems that the only solution is building haxe from source.
Haxe – neko
2.* – 1.*
3.0.0 – 2.0.0
3.1.3 – 2.0.0
3.2.0 – 2.0.0
3.3.0 – 2.1.0
After building Haxe version 3.4.0 from source I was able to compile. This problem has been reported in openfl github as an issue: https://github.com/openfl/openfl/issues/1421
Since I’m a linux user I do not know if there is any issue with the windows or mac versions, if you experienced any issue please let me know so I can post it here as this documentation aims to be a helping guide for people starting with Haxe and openfl.
For this concrete game it also was needed to set up version of lime and openfl to make it compatible with flixel, this was easy to find out as it is reported during the compilation with the command needed to set up versions.
The first thing I want to do is to make the graphics bigger and to paint them myself.
For this purpose I changed Screen size in “Main.hx”
class Main extends Sprite
public function new()
//addChild(new FlxGame(320, 240, MenuState));
addChild(new FlxGame(1024, 768, MenuState));
The second thing, to be able to draw the enemies myself I changed in “Enemy.hx” the follwing line:
* Create a new enemy. Used in the menu and playstate.
override public function new(X:Float, Y:Float)
//super(X, Y, Reg.enemyImage);
super(X, Y, “images/enemy.png”);
health = maxHealth;
The next thing I would like to do is to make tiles bigger and load them from a file so that I can create my own tiles from a draw software and I can give more resolution.
I found the code where the tiles are loaded in “MenuState.hx” and “PlayState.hx”:
// Load a map from CSV data; note that the tile graphic does not need to be a file; in this case, it’s BitmapData.
_map = new FlxTilemap();
The developer states that tiles do not need to be a file but I want them to be a file. Now I’m stucked, I tested inserting file with path into the second parameter with no success. Any help regarding this would be welcome.