Spritesheet Problem

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:

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

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

    game.load.spritesheet('button1', '../tileMap/location1.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?



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.