Jump to content

Recreating tanks game, Error with JSONData:function of phaser.min.js


n3amarvalia
 Share

Recommended Posts

Hi All, 
this is my first post, I recently discovered the Phaser framework and I really really enjoy it =). I have a problem now tho, I wanted to code out the tanks game example located on the site, but when i tired to run the game I ran into a show stopping error:
 

TypeError: c is null  JSONData: function(a,c,d)if(!c.frames) 

 
This is located in my phaser.min.js on (line 12, col 29368)
 
I tired tracing the code back but couldn't seem to figure this problem out. 
 
Im going to assume that this is being thrown from my line of code in my main.js:

 game.load.atlas('tank','assets/tanks/tanks.png');

I was searching the phaser.js file and located the atlas function and noticed the parameters are :

atlas: function (key, textureURL, atlasURL, atlasData, format) 

So i feel like I'm missing some understanding here, any help would be greatly appreciated :)

 

p.s.: also any general posting tips would be awesome too 

Link to comment
Share on other sites

An atlas needs a texture (which you've got) AND a json data object that describes how all of your images are laid out in the texture. You're missing that bit, which is why it's erroring. Are all of your sprites actually in a texture atlas?

 

I'd suggest you use phaser.js to develop with (not phaser.min.js) as you'll get much more exact line numbers and less strange error messages too :)

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

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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