Skip to content

danieltdt/crafty-tiled-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiled Map - Crafty.js plugin for Tiled Map Editor

Tiled Map is a plugin for Crafty.js for loading tiled maps (from Tiled Map Editor) and use them on a Crafty scene.

Usage

Crafty.scene('Main', function () {
  var mapLoader = new Crafty.TiledMap('url/to/tiled/map.json');

  mapLoader.downloaded(function (err, json) {
    // Errors on downloading json comes here.
    if (err) throw err;

    var map = Crafty.e('TiledMap');

    // Create entities based on json;
    map.setTiledMap(JSON.parse(json));

    // Optionally, you can change Crafty camera to follow the given entity,
    //   caching not visible tiles.
    map.cameraFollow(Crafty('Player'));
  });
});

Demo

WIP

Thanks

This plugin is based on Jonas Olmstead's post about tiled maps; and an old crafty.js component for tiled map editor (I couldn't find the link ): )

About

Crafty.js plugin for tiled maps created with Tiled Map Editor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published