Embarissed

Resources List

Recommended Posts

Hi. I just finished the tutorial but have a problem I can't quite figure out. In the tutorial, it says to add 

// game font
{ name: "PressStart2P", type:"image", src: "data/fnt/PressStart2P.png" },
{ name: "PressStart2P", type:"binary", src: "data/fnt/PressStart2P.fnt"},

 So originally I added this to build/js/resources.js because this is the only resources.js I had. I added the fonts to that file and it worked until it was rebuilt then it would disappear. Then I noticed I am supposed to have a resources.js in my boilerplate/js folder, so I copied the one from the build into there but that file is not getting read as it says "Uncaught File containing font data was empty, cannot load the bitmap font." Did I miss a step somewhere? Sorry if this has an obvious answer.

Share this post


Link to post
Share on other sites

I do not think the file is corrupted. I redownloaded the Tutorial_data files and replaced everything in the fnt folder but am still getting the same error. Also, the HUD displays the score correctly, if I manually enter the font into build/js/resources.js after every build. It's specifically fonts though, as my tilesheets are still being added to the resources list. Any other ideas?

 

Untitled.png

Share this post


Link to post
Share on other sites

The boilerplate will automatically generate the resources.js file for you. But the generator does not know about every possible file type. You'll want to add a special case for your font files, see here for the default file patterns: https://github.com/melonjs/boilerplate/blob/7f4a7a581f85bd0e4b6c117f744218233d473dd8/Gruntfile.js#L132-L147

Share this post


Link to post
Share on other sites

I understood that. That's why in the tutorial it says to manually add the fonts to the resource list. I can't imagine however that you are supposed to manually add them every single time you make a change ie. change a tmx file or add a sprite. 

But, thanks Parasyte, adding the following code, 

,{
          src: ['data/fnt/**/*.fnt'],
          type: 'binary'
        },{
          src: ['data/fnt/**/*.png'],
          type: 'image'
        }

Had it add the fonts automatically. This wasn't in the tutorial though, so I'm still confused as to if this is just a workaround or the correct way to fix this problem. But for now, I'll take it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.