Embarissed Posted January 22, 2017 Share Posted January 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
obiot Posted January 23, 2017 Share Posted January 23, 2017 sounds like melonJS cannot find the " data/fnt/PressStart2P.fnt " file, or that the file itself is empty/corrupted. Quote Link to comment Share on other sites More sharing options...
Embarissed Posted January 23, 2017 Author Share Posted January 23, 2017 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? Quote Link to comment Share on other sites More sharing options...
Parasyte Posted January 25, 2017 Share Posted January 25, 2017 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 Quote Link to comment Share on other sites More sharing options...
Embarissed Posted January 26, 2017 Author Share Posted January 26, 2017 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. obiot 1 Quote Link to comment Share on other sites More sharing options...
obiot Posted January 26, 2017 Share Posted January 26, 2017 i'll fix that in the boilerplate ! Quote Link to comment Share on other sites More sharing options...
Parasyte Posted January 27, 2017 Share Posted January 27, 2017 I think it's a problem with the tutorial expecting that the boilerplate `serve` task won't be used ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.