Let’s pick up right from we left things last time. We finally had our “ship” moving around and being able to shoot bullets, right?
That’s great, but now it’s the time to set up a way to load tiled levels and even more, we need at least one level to be able to test everything out!
We will fix that right away, but to do so we need to use a new tool to build our level.
Introducing Tiled editor
Tiled is a simple tilemap level editor. You can use its simple graphic interface to place tiles around, set up different objects and group them inside various layers. It’s really easy to use and you’ll get the hang of it in no time.
Download Tiled fro its website and fire it up. Select File -> new and create an orthogonal tiled level with 32×32 tile size and with a width of 100 tiles by a height of 15 tiles (this will fit the full height of our set up screen, because our vertical resolution is 480 = 15*32).
Creating our new test map
Hello there!, today we are going to go straight to business by starting with the first stage of a multi-part tutorial on how to build a simple -yet very illustrative- game using the wonderful HaxeFlixel framework <3
The idea here is rather simple. We are going to create the skeleton of a 2D horizontal space shooter game, in the style of Gradius, R-Type or Thunder Force. You know the drill. But you probably have already seen lots of tutorials on teaching how to do something similar. Problem is, most of those tutorials show you how to build a game where there is no actual scenario or pattern to the game. Probably they just generate enemies and obstacles in a random way, and leave you with the simple goal of surviving and ranking up as many points as you can.
Having customized scenarios and accurate enemy placement really bring these games to life
That’s ok and really nice, but I want to give this tutorial a twist, and for that we are going to lay the groundwork for you to build a space shooter that you will be able to expand on. We are going to have custom levels that you will be able to design freely in a level editor, without having to touch a single line a code.
Are you up for it?, let’s get started then!
Today I just wan’t to be brief and concise about a discovery I made a few months ago that completely blew my mind. That discovery is called HaxeFlixel. It is a 2D game engine and it rocks. It rocks hard and I totally adore it.
Yeah, that’s it.
What?, you still there?
Ok, ok, I’ll elaborate a bit more on my reasons for this love, but only because you insisted.
It’s easy to set up
Ok, this may not sound like a big deal, considering it would be something you only have to do once and then you can just forget about it for eternity. That may be true, but in practice trying to install and configure a development environment for a specific engine can be a complete pain in the ass. Specially if it involves the use of Eclipse (God i hate that thing).
HaxeFlixel just plays it cool and fast. You open up the terminal, type a few lines and wait for the whole thing to get installed. It works fast a as you would expect, and it even allows you to integrate your projects with Sublime Text, which is absolutely lovely as well. After this you just create a new project and HaxeFlixel conveniently creates the file structure and some boilerplate code for you to get started as soon as possible.
No messing around with paths, configuration files or process that don’t go as planned. This thing is running in less than 5 minutes.