boolean's Forum Posts

  • Ashley sqiddster

    So I found a way around this, at least for published versions. Try publishing the capx above and then before the closing head tag (in index.html) add:

    <script>

        WebFontConfig = {

          custom: { families: ['Conv_VAGRundschriftD'],

          urls: ['fonts.css']

        }

    };

    (function() {

    var wf = document.createElement('script');

    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +   

    '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';

    wf.type = 'text/javascript';

    wf.async = 'true';

    var s = document.getElementsByTagName('script')[0];

    s.parentNode.insertBefore(wf, s);

    })();

    </script>

    This seems to force the font to load and all works fine. However, while that works for published games it doesn't help during preview mode (just because it's not as easy to edit the files).

    Test page using this technique

    Using the above code (with the "families" property changed to my own font family) I was able to publish my game and get it running. It still doesn't really answer why it's not working in the first place though. What technique is C2 using to load webfonts at the moment?

  • If you are using Chrome: F12 > Settings (bottom right) > General > Disable Cache. Also, try adding a question mark plus a random string to the end of your url (eg. localhost:5000?789h7)

    Edit - I just realized you are probably making changes to your game, but refreshing your browser manually. You need to run the preview again from inside C2 in order to push the latest changes to the browser.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • sqiddster

    I might have figured out what the problem is. Can you do a quick test?

    1) Run the font .capx I linked to in preview mode with WebGL enabled.

    2) Change "localhost:5000" to "http://localhost:5000".

    Do the webfonts suddenly work for you then?

    Edit - Curious, this works if you have WebGL turned on and you are loading the font from an external source. I changed mine to point to a google font and the trick above allows it to work. However it's still not allowing local fonts to load.

  • I've been poking around the internet and I can't seem to dig up any info on this <img src="smileys/smiley12.gif" border="0" align="middle">

    The closest I could find was a bug ticket for GameMaker. The admin responded by saying that the fonts have to be fully loaded before WebGL kicks in. I tried playing about with the runtime.js file to simulate this but there's just a bit too much code to shuffle around. Could this be anything even close to what might be causing it in C2?

    One other note: Webfonts with WebGL do seem to work in other games in Chrome. Example. In all the WebGL enabled HTML5 demos I could find that use webfonts, Chrome seems to load the fonts fine.

  • In terms of previewing the data, I highly recommend installing the plugin "Console Logger" by wgfunstorm with array logging functionality added by me:

    Download

    This then spits your array out into the console tab:

    <img src="http://i.imgur.com/rh69Q.png" border="0">

    Or in the case of large arrays:

    <img src="http://i.imgur.com/fM6Du.png" border="0">

  • I'm not really sure why this would be a problem, but it would seem that enabling WebGL in C2 breaks webfonts in Chrome <img src="smileys/smiley5.gif" border="0" align="middle">

    I tried running the sample capx from this thread by lemo. The sample capx from that thread is: Capx

    If I run the capx in Chrome (version 25) with WebGL enabled, the webfont never loads. If I disable WebGL it works fine.

    Any idea why this would be happening? I'm not sure if this is a driver thing, a chrome thing or a construct thing. Does anyone else experience this issue? Any ideas what could be causing it?

  • Ashley : Any further thoughts after the post+sample above?

  • Does clearing the cache in firefox help?

  • With the collecting of parts and the little green alien, it reminded me of Cosmo's Cosmic Adventure <img src="http://upload.wikimedia.org/wikipedia/en/6/6d/Cosmo.gif" border="0" />

  • Just noticed this myself - Broken for me too.

  • HA! Arima you're a genius. Who would have ever thought to look there! Months I've been wanting this feature <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Sounds like it's working properly. If you issue the action while the fade is fading, the fade will override the opacity you set.

    It's not so much that the fade is overwriting the fade, but that the fade is starting at the wrong opacity. If I do the following steps:

    1) Create a sprite, add fade behaviour and set "Active at start" to false.

    2) "On Spacebar down", set opacity to 50

    3) Start fade.

    Sample Capx

    Instead of the sprite starting at 50 and moving down to 0, it goes back to 100 (the default opacity) and then starts fading to 0. The reason being that it's basing the start opacity on maxOpacity, which gets set when the layout starts (not the new opacity I set in the action).

  • Oh god THIS. I ran into this the other day when I realized I needed to reduce the size of my layout - I grabbed about 50 sprites, resized them using the handles, and then cried a little tear when I realized C2 treats them all individually.

  • Ideally C2 should be able to update function names like instance variables or global variables, as opposed to allowing us to use global variables as function names (which would get messy).

    So while I think that allowing constants as function names is the best idea, I do think that having the IDE update function names automatically just like instance variables or global variables would be amazing. I'm currently using wingrep on my game folder for any function name updates <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm not sure if this would be considered a bug.

    I'm using the fade behaviour. When you first run the game, the plugin seems to run through all the sprites in the layout and get their opacity, setting "this.maxOpacity" to the current opacity.

    This seems to have an odd side effect: If I set a sprite to opacity 50 in it's properties, maxOpacity is set to 50 on load and it fades out correctly. However if I set the opacity through an action then maxOpacity is already set to 100 on load, causing the fade behaviour to jump from 50 back to 100, then fade out.

    Does this seem like a bug? I'm hesitant to report this if I'm just missing a step.