dianxiangan32 Posted September 1, 2014 Share Posted September 1, 2014 I check the example for the whole morning http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=mario.js&t=mario But one thing I don't know why. When I changemap.addTilesetImage('SuperMarioBros-World1-1', 'tiles');tomap.addTilesetImage('SuperMarioBros-World1-1');It doesn't work! I put the image exactly in the server root. The phaser give me the warning:Phaser.Tilemap.addTilesetImage: Invalid image key given: "SuperMarioBros-World1-1" So does it mean that I must user the 2nd paremeter? Link to comment Share on other sites More sharing options...
beeglebug Posted September 1, 2014 Share Posted September 1, 2014 If you don't pass the second argument, Phaser uses the first argument as the key to look up the image. In the example, the image is in the cache with a key of 'tiles', so when you remove that argument, Phaser tries to lookup an image with the key 'SuperMarioBros-World1-1' instead, and fails. The first argument is the name of a tileset, which can sometimes share a name with the image (hence the optional argument), but in this case is rendered using the image 'tiles'. Link to comment Share on other sites More sharing options...
Kobaltic Posted September 1, 2014 Share Posted September 1, 2014 Short answer. If the first and second parameter are the same you only have to pass the first one. If they are different (such as yours) you must pass both of them. See of above for explanation. Link to comment Share on other sites More sharing options...
Recommended Posts