kray Posted April 8, 2015 Share Posted April 8, 2015 I have an atlas containing all letters. Due to some reason, the image chosen from the atlas is not being displayed. Instead, it just shows a black box.My preloader: preload: function() { this.load.spritesheet('dude', 'asset/dude.png', 32, 48); this.load.atlas('alphavets','asset/letters.png','asset/letters.json'); this.load.image('ground','asset/platform.png'); this.load.image('sky','asset/sky.png'); }Using the atlas: var x = Math.floor(Math.random()*1000)%this.world.width; var letter = this.add.sprite(x, 0, 'alphabets'); letter.frameName = "a.png"; this.physics.arcade.enable(letter); console.log("Chosen: "+img); letter.body.gravity.y = 200;Why is this happening? The console also says phaser.js not found. I have copied phaser.min.js to my folder. Link to comment Share on other sites More sharing options...
mxmlb Posted April 8, 2015 Share Posted April 8, 2015 So, without seing your atlas file, I can already tell : - you are loading "alphavets" and using "alphabets"- you are using spritename "a.png", check if it's this in your json or just "a" (some packers trim the file extension)- for simplicity, you can do : this.add.sprite(posX, posY, "alphabets", "a.png") to avoid another line setting the initial frame name Link to comment Share on other sites More sharing options...
Recommended Posts