Majirefy Posted March 2, 2017 Share Posted March 2, 2017 I load a sprite sheet image file in preload states: this.game.load.spritesheet('rings', Assets.Images.ImagesBlocksRings.getPNG(), 100, 100); Assets.Images.ImagesBlocksRings.getPNG() returns url of image file like "../assets/rings.png". Then I add a Phaser.Image object in main state: this.ring = this.game.add.image(this.game.world.centerX, this.game.world.centerY - (this.game.world.centerY / 2), 'rings'); But when I run my game, instead of showing a frame, it shows the whole sprite sheet image, not slicing into frames. If I change the key of sprite sheet to "_rings", it will work fine. Or If I put load into the preload function in main state, it will work fine, too. Why is that? PS: I check the key in Phaser.Cache, it will return true unless after load. Link to comment Share on other sites More sharing options...
ldd Posted March 3, 2017 Share Posted March 3, 2017 per the documentation: new Phaser.Image(game, x, y, key, frame) so you are missing an argument to specify the frame ps: why is this forum using a rich text editor and not markdown? +.+ Link to comment Share on other sites More sharing options...
Majirefy Posted March 4, 2017 Author Share Posted March 4, 2017 On 2017/3/3 at 10:29 AM, ldd said: per the documentation: new Phaser.Image(game, x, y, key, frame) so you are missing an argument to specify the frame ps: why is this forum using a rich text editor and not markdown? +.+ Thanks. I found out. Because I used a Phaser Template. It loads everything in assets folder automatically and gives keys by file name. So this happened. ldd 1 Link to comment Share on other sites More sharing options...
Recommended Posts