Jump to content

Problem with Phaser and Tilemaps


Meeeeeeeh
 Share

Recommended Posts

Whenever I try to use a tilemap from Tiled, it never shows up in my browser. All I see is a black screen. As I'm relatively new to this, I've tried following along with tutorials and examples about how to use tilemaps with Phaser, but no matter what, it never seems to work. Does anyone know what the problem could be?

 

I use Brackets.

<!doctype html> <html lang="en"> <head> 	<meta charset="UTF-8" />	<title>Insert Title Here</title>    <script src="phaser.min.js"></script>    <style type="text/css">        body {            margin: 0;        }    </style></head><body><script type="text/javascript">var game = new Phaser.Game(640, 640, Phaser.AUTO, '', { preload: preload, create: create, update: update });    var map;var backgroundLayer;var blockLayer;    function preload(){    game.load.tilemap('myTilemap', 'assets/scifi.json', null, Phaser.Tilemap.TILED_JSON);    game.load.image('myTileset', 'assets/scifi_platformTiles_32x32.png');}    function create(){    map = this.add.tilemap('myTilemap');    map.addTilesetImage('scifi_platformTiles_32x32', 'myTileset');        backgroundLayer = map.createLayer('background');    blockLayer = map.createLayer('blocklayer');}    function update(){    }    </script></body></html>

Also, my Google Chrome console displays this:  Uncaught TypeError: Cannot read property '0' of undefined phaser.min.js:25

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...