Wednesday 7 June 2017


Create Tiled Game Engine using GDX

The sourcecode of the game inside the package in sourcecode of GDX test.adventureengine
Game we 're going to create is introduced by below image:Create tilemap -tmx file


Characters that runs around the map and when he is come to the snow, the character's score will increase. Score is displayed on the screen (Red). The player controls with the arrow keys and the keys W, A, S, D control camera.
Firstly, tilemap editor download page http://mapeditor.org and install then open the program, you import a certain texture to  make the tiles, download a tiled texture like:


Note: tmx file and texture file to the same folder set. The file name must not contain an underscore '_'
You design a certain map like I did:
Note:
  • You divide the map in the background layer (the object is rendered on top of this layer - eg terrain) . Foreground: the render layer on top of other objects (eg trees). Food containing images of snow - where players eat. No pass is the tile layer orange mushroom-shaped signs tile that player does not "pass" is. This means it's limits player movement. Layer Obstacle have nothing special. It contains the tiles will render the "nopass" for player - for example: Tree Root Hole...
  • Object layer is not a tile layer. When a new layer on your new mapeditor, you will have the option to create a tile layer or object. In the map above, the object layer objects used to mark the position of player (a small square on the map). To set additional properties for an object in the object layer, click on Layer in the Layer Window object first, then right click on the object and choose Object Properties.
  • The index of the layer it, layer the bottom with the index 0 The layer above it is 1, the next layer has index is 2... Thanks tiledmap index that would specify the correct layer need rendering, you shouldn’t render layer is removed index is 3 (This is NoPass layer) because NoPass tile layer containing only the marker indicating the position that player doesn’t have permission to pass through it, no need to render the layer onto the screen.
  • Tilesets In the window, you can right click on a tile and select any tile to tile properties to add that property. Here tile "orange mushroom" I set property "NoPass" has value is 1, so that later we programmed the player does not pass through the tile that is.
After drawing the map and save the file You will have the file *.tmx, but currently the  file is not readable by libgdx framework. You should have to compile map. Here is some steps that will help you compile the tmx using some tools from libgdx framework.
Steps:
- Create a folder, for example: TiledMap
- In TiledMap folder, create 2 source folder, nguon (source map) and dich (compile map).
numbering in FIGURE:
(1) - in the source map you copy 2 file tmx file (the original file that you just drew)
and png file (tileset file that you used to draw material tmx)
(2) - copy gdx.jar, GDX-tiled- processor.jar and GDX-tools.jar directory TiledMap
(3) - create a file .bat with content:
java -classpath gdx.jar;gdx-tools.jar;gdx-tiled-preprocessor.jar com.badlogic.gdx.tiledmappacker.TiledMapPacker nguon dich --strip-unused
Double click on run.bat file => the translated files will appear 3 (4).
Notice: Please delete all old compiled map before to compile a new version of map.
Now I will guide you load tmx file that you design, compile and import to the eclipse

We just moved the source code to Github!

Hello everyone, thank you for your feedback and suggestions,

Now the source code of GDX Engine is available on Github

https://github.com/game-libgdx-unity/GDX-Engine

You can install a git client to clone the source code, commit and create your pull request!

SourceTree is recommended git client! (Download: https://www.sourcetreeapp.com/)