Jump to content

Spritesheet Problem


jdiego82
 Share

Recommended Posts

My code is showing:

 

Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight

Uncaught TypeError: Cannot read property 'sourceSizeW' of null

 

on the JS console

 

My Code:

var game = new Phaser.Game(1000, 600, Phaser.AUTO, "gameFrame", {preload: preload, create: create, update: update});var pirate;function preload(){    game.stage.backgroundColor = '#007236';    game.load.spritesheet('pirate', 'assets/spritesheet1.png', 92, 105, 9);}function create(){    pirate = game.add.sprite(300, 200, 'pirate');    pirate.animations.add('walk');    pirate.animations.play('walk', 20, true);}

The spritesheet:
http://imgur.com/YyFqUPv

Link to comment
Share on other sites

Nevermind, guys. I managed to solve this by changing the width and height parameters on the game.load.spritesheet function a bit. It seems like I managed to switch my width and height values. Anyway, thanks for the help, rich. :)

I'm making my first Phaser game for my final school project, so this probably won't be my last post here.

Link to comment
Share on other sites

  • 4 years later...

Hey, @samme thank you for your quick reply. Actually, I am loading two spritesheet 

    game.load.spritesheet('button1', '../tileMap/location1.png', 50, 35);
    
    game.load.spritesheet('player','../tileMap/bot2.png',50,35);

If I am loading only bot2.png(if locaton1.png is commented) It is working fine but after loading location1.png its giving warning.What can be the possible problem here?

bot2.png

location1.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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