Jump to content

Tilesheet, Tilemap Errors


Bigchanguito
 Share

Recommended Posts

Hi everybody!
 
I am a new phaser user, I have experience in other frameworks and with other programming lenguages and I discovered recently Phaser. I am really in love with it :)
 
I've been working through the examples and documentation, some tutorials and more... and everything was going fine, but since yesterday, after finish the "Topdown tutorial" from "gamedevacademy.org" I am experiencing an issue with tilemaps in my own project... I've been looking for other topics from other users with the same problem, but their "solutions" doesn't work for me :( and I am desperated, because I can't figure out what I am doing wrong...
 
This is my code:

Preload.js : 
 
this.load.tilemap('level1', 'assets/tilemaps/level_1_ok.json', null, Phaser.Tilemap.TILED_JSON);
this.load.image('gameTiles', 'assets/images/tilesheet_platformer_1.png');
 
Game.js :

this.map = this.game.add.tilemap('level1');
this.map.addTilesetImage('tiles', 'gameTiles');
 
 
The output error message I am receiving is attached to this post. Please anybody could lend me a hand on this? I am very frustrated not being able to solve this issue.
 
If you need me to upload the project or anything more to be able to help me, please ask.
 
I'll be waiting for any answer, thank you!

 

 

 

post-13005-0-77846900-1423218886.png

Link to comment
Share on other sites

Hi, it looks like your json file is not loaded. I had also problems with loading json files, but it was not problem of Phaser itself. I am using Visual Studio 2013 and it runs my games with IIS server. The server with its default config did not know what json file is and it returned error 404, but the game continued and failed when the file had to be parsed by engine.

 

If you use IIS then you are probably missing red lines (red was removed so I added * in front) in your web.config file:

<configuration>  <system.web>    <compilation debug="true" targetFramework="4.5" />    <httpRuntime targetFramework="4.5" />  </system.web>  <system.webServer>*    <staticContent>*      <mimeMap fileExtension=".json" mimeType="application/json" />*    </staticContent>  </system.webServer></configuration>

 Or try your game also with Mongoose server (150kb server) (https://code.google.com/p/mongoose/) It does not need to do any special settings to read json. (I am getting some false positive alerts from AVG when running Mongoose).

Link to comment
Share on other sites

Thank you very much for the answer :)
 
Unfortunately I am working on OsX so I can't use Mongoose, anyway I am using MAMP and everything seems to work fine... Finally I could load my map.
 
But now I have another weird issue, The tiles that phaser are drawing on the screen aren't the same ones from my map, if you see the two screenshots, the tiles change when the "game" is launched. The first image shows my map and the second one the map that phaser draws.
 
I am searching for more people having this issue but I can't find anyone...
Somebody please can help me? I am wasting a lot of time trying to make this work, and I can't really figure out what's wrong or what I am doing wrong.
 
Thanks.

2rzp8w3.png

 

2vjd7au.png



 

Link to comment
Share on other sites

  • 2 weeks later...

I have no experience with this, but one thing comes to my mind. It looks like your original RGB image is for some reason loaded as BGR... create additional tiles with solid colors: red, green blue and check it in Phaser. If red and blue will be flipped, then the problem is RGB x BGR somewhere...

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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