All Projects → Dvergar → Pyxeledit Map Importer

Dvergar / Pyxeledit Map Importer

Parser for maps generated by the editor PyxelEdit

Programming Languages

haxe
709 projects

Projects that are alternatives of or similar to Pyxeledit Map Importer

Tiledmapview
Tiled map loader for Android , based on the pyramid model, supports a variety of projections, including Web Mercator projection, latitude and longitude projection and custom projection; supports locating, adding layers and overlays. Android瓦片地图加载控件,基于金字塔模型,支持多种投影,包括Web墨卡托投影,经纬度直投及自定义投影等;支持定位,添加图层和覆盖物。
Stars: ✭ 45 (+40.63%)
Mutual labels:  tile, tilemap
FyWorld
FyWorld - Base-Building / Simulation Game & Tutorial in Unity
Stars: ✭ 207 (+546.88%)
Mutual labels:  tile, tilemap
Phaser Arcade Slopes
📐 A Phaser CE plugin that brings sloped tile collision handling to the Arcade Physics engine
Stars: ✭ 124 (+287.5%)
Mutual labels:  tile, tilemap
UnityHexagonLibrary2d
A library to manage 2D hexagonal tiles in Unity.
Stars: ✭ 58 (+81.25%)
Mutual labels:  tile, tilemap
Litiengine
LITIENGINE 🕹 The pure 2D java game engine.
Stars: ✭ 384 (+1100%)
Mutual labels:  tile, tilemap
AsLib
🎨: RPG map maker (paint tool)
Stars: ✭ 82 (+156.25%)
Mutual labels:  tile, tilemap
TileAssistTool
🎨 Windows10 磁贴辅助小工具
Stars: ✭ 24 (-25%)
Mutual labels:  tile
Von Grid
Hexagonal & square tile grid system with three.js
Stars: ✭ 336 (+950%)
Mutual labels:  tilemap
cl-tiled
Tiled map library for CL
Stars: ✭ 15 (-53.12%)
Mutual labels:  tilemap
tuile
Tuile (french for tile) is a 2D graphics engine inspired from old hardware and based on layers, tiles sets, tile maps and sprites. Its scanline rendering pipeline makes it perfect for raster effects.
Stars: ✭ 19 (-40.62%)
Mutual labels:  tile
Sprytile
A Blender add-on for building tile based low-poly scenes with paint/map editor like tools
Stars: ✭ 741 (+2215.63%)
Mutual labels:  tile
Vector Datasource
Tilezen vector tile service - OpenStreetMap data in several formats
Stars: ✭ 427 (+1234.38%)
Mutual labels:  tile
Mappa
A canvas wrapper for Maps 🗺 🌍
Stars: ✭ 290 (+806.25%)
Mutual labels:  tilemap
texture generator
Generating procedural textures
Stars: ✭ 23 (-28.12%)
Mutual labels:  tilemap
Navmeshplus
Unity NavMesh 2D Pathfinding
Stars: ✭ 347 (+984.38%)
Mutual labels:  tilemap
meta2d
Meta2D is open source WebGL 2D game engine for making cross platform games.
Stars: ✭ 33 (+3.13%)
Mutual labels:  tilemap
React Game Kit
Component library for making games with React & React Native
Stars: ✭ 4,480 (+13900%)
Mutual labels:  tilemap
videowall
Video wall with multiple tiles that enables synchronized video playback, mirrored or tiled.
Stars: ✭ 57 (+78.13%)
Mutual labels:  tile
Ngu Carousel
Angular Universal carousel
Stars: ✭ 263 (+721.88%)
Mutual labels:  tile
Pdftilecut
pdftilecut lets you sub-divide a PDF page(s) into smaller pages so you can print them on small form printers.
Stars: ✭ 258 (+706.25%)
Mutual labels:  tile

PyxelEdit-Map-Importer

Available via haxelib

Pyxel Edit map parser for haxe. With OpenFL, Heaps and Luxe helpers.

Pyxel Edit + flash version

Usage

  • Export your map File > Export tilemap as XML...
  • Export your tileset File > Export tileset...

Make use of the PyxelEdit-Map-Importer tools with import pmi.PyxelMapImporter

Loading the map

Assuming you're not necessarily using any graphical framework (server for example) :

var pyxelMap = new PyxelMapImporter(sys.io.File.getContent("map.xml")); will load the xml pyxel map. The argument is the xml content as String.

Extracting layer datas

Pyxel Edit layer view

var background = pyxelMap.getDatasFromLayer("background");

  • "background" is the name of the layer in PyxelEdit.
  • background (the variable) is an object of type Layer.

Layer.tiles is an Array<Tile> where you can access fields : x, y, index,rot & flipX as it is in the XML, those datas are exposed in an cleaner way than the XML file and let you use some of the parameters i'm not using in the other methods.

Make those layers a tile array

var backgroundArray = pyxelMap.getLayerArray(background) will return an map array of type Array<Array<Int>> allowing you to check the tile ID with backgroundArray[x][y].

You can also use it to get a collision map. If, for example, you name a PyxelEdit layer "collision" and dedicate a red tile for collisions, you can then extract that layer and check if there is a collision with a simple collisionArray[x][y].

IDs assignation

IDs are assigned in order of appearance in your Pyxel Edit tileset window :

Tileset IDs

So let's say your collision red tile is at the rank 5, to check a collision you'll have to check if collisionArray[x][y] == 5: This is not a 0/1 collision map.

-1 refers to "no tile".

Example

import pmi.PyxelMapImporter;

class Main
{
    public function new()
    {
        var pyxelMap = new PyxelMapImporter(sys.io.File.getContent("map.xml"));
        var background = pyxelMap.getDatasFromLayer("background");
        var backgroundArray = pyxelMap.getLayerArray(background);
    }
}

OpenFL helper

You can make use of pmi.OpenflHelper to get a tilesheet object and a tile array easily.

  • var tileset = OpenflHelper.getTileset("assets/tileset.png"); will return a Tileset object.
  • var tilemapBackground = OpenflHelper.getTilemap(background, tileset); will return a Tilemap object.

and that's all you need.

Note that to load an openFL asset (the pyxel xml map) you would need new PyxelMapImporter(Assets.getText("assets/map.xml")); here.

Example

It will load three different layers and will draw them on screen.

import openfl.display.Sprite;
import openfl.Assets;
import openfl.display.Tilesheet;

import pmi.PyxelMapImporter;
import pmi.OpenflHelper;


class Main extends Sprite
{
    public function new ()
    {
        super();
        var pyxelMap = new PyxelMapImporter(Assets.getText("assets/map.xml"));
        var background = pyxelMap.getDatasFromLayer("background");
        var walls = pyxelMap.getDatasFromLayer("walls");
        var objects = pyxelMap.getDatasFromLayer("objects");

        var tileset = OpenflHelper.getTileset("assets/tileset.png");

        var tilemapBackground = OpenflHelper.getTilemap(background, tileset);
        var tilemapWalls = OpenflHelper.getTilemap(walls, tileset);
        var tilemapObjects = OpenflHelper.getTilemap(objects, tileset);

        addChild(tilemapBackground);
        addChild(tilemapWalls);
        addChild(tilemapObjects);
    }
}

Luxe helper

You can make use of pmi.LuxeHelper to get a Tilemap object and and fill the tilelayers easily.

  • var tilemap = LuxeHelper.getTilemap('assets/tileset.png'); will return a Tilemap object.
  • LuxeHelper.fillLayer(tilemap, background); will add the appropriate tilelayer to the tilemap.

and that's all you need.

Note that to load a luxe asset (the pyxel xml map) you would need new PyxelMapImporter(Luxe.loadText("assets/map.xml", null, false).text); here.

Example

It will load three different layers and draw them on screen.

import pmi.PyxelMapImporter;
import pmi.LuxeHelper;


class Main extends luxe.Game
{
    override function ready()
    {
        var pyxelMap = new PyxelMapImporter(Luxe.loadText("assets/map.xml", null, false).text);
        var tilemap = LuxeHelper.getTilemap('assets/tileset.png');
        var background = pyxelMap.getDatasFromLayer("background");
        var walls = pyxelMap.getDatasFromLayer("walls");
        var objects = pyxelMap.getDatasFromLayer("objects");

        LuxeHelper.fillLayer(tilemap, background);
        LuxeHelper.fillLayer(tilemap, walls);
        LuxeHelper.fillLayer(tilemap, objects);

        tilemap.display({});
    }
}

Heaps helper

You can make use of pmi.HeapsHelper to get a TileSet and TileGroup object.

  • var tileSet = HeapsHelper.getTileSet("tileset.png"); will return a TileSet object.
  • var backgroundTileGroup = HeapsHelper.getTileGroup(background, tileSet); will return a TileGroup object.

and that's all you need.

Note that to load a heaps asset (the pyxel xml map) you would need new PyxelMapImporter(hxd.Res.loader.load("map.xml").toText()); here.

Example

It will load three different layers and draw them on screen.

import pmi.PyxelMapImporter;
import pmi.HeapsHelper;


class Main extends hxd.App
{
    override function init()
    {

        var pyxelMap = new PyxelMapImporter(hxd.Res.loader.load("map.xml").toText());
        var tileSet = HeapsHelper.getTileSet("tileset.png");

        var background = pyxelMap.getDatasFromLayer("background");
        var walls = pyxelMap.getDatasFromLayer("walls");
        var objects = pyxelMap.getDatasFromLayer("objects");

        var backgroundTileGroup = HeapsHelper.getTileGroup(background, tileSet);
        var wallsTileGroup = HeapsHelper.getTileGroup(walls, tileSet);
        var objectsTileGroup = HeapsHelper.getTileGroup(objects, tileSet);

        s2d.addChild(backgroundTileGroup);
        s2d.addChild(wallsTileGroup);
        s2d.addChild(objectsTileGroup);
    }

    public static function main()
    {
        hxd.Res.initEmbed();
        new Main();
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].