Theasker

Members
  • Content Count

    4
  • Joined

  • Last visited

About Theasker

  • Rank
    Newbie

Contact Methods

  • Twitter
    @theasker
  1. Load control of fonts before game starts
  2. I have a code like this: fonts.css @font-face{ font-family: 'LiberationMono'; src: url('../fonts/LiberationMono-Regular-webfont.eot'); src: url('../fonts/LiberationMono-Regular-webfont.eot?iefix') format('eot'), url('../fonts/LiberationMono-Regular-webfont.woff') format('woff'), url('../fonts/LiberationMono-Regular-webfont.ttf') format('truetype'), url('../fonts/LiberationMono-Regular-webfont.svg#webfont') format('svg'); } @font-face { font-family: 'archivoblackregular'; src: url('../fonts/archivoblack-regular-webfont.woff2') format('woff2'), url('../fonts/archivoblack-regular-webfont.woff') format('woff'), url('../fonts/ArchivoBlack-Regular.ttf') format('truetype'); } fonts = "30pt LiberationMono"; fontTitles = "50pt archivoblackregular"; ... text = this.game.add.text(this.game.world.centerX, 130, "┬┐What option is the correct?", { font: fontTitles, fill: "#005ba6", align: "center" }); text.anchor.set(0.5) But in the first round does not work. I have thought to use this as it says in https://hacks.mozilla.org/2016/06/webfont-preloading-for-html5-games/ var fontLoaded = false; var gameCreated = false; function createText() { if (!fontLoaded || !gameCreated) return; game.add.text(0, 0, 'Lorem ipsum', { font: '12px Amatica SC', fill: '#fff' }); } function preload() { let font = new FontFaceObserver('Amatica SC'); font.load().then(function () { fontLoaded = true; createText(); }); } function create() { gameCreated = true; createText(); } But it's a lot of code change, since my games are all with text. Thanks in advance.
  3. Theasker

    Two events

    It's work fine. Thx
  4. Theasker

    Two events

    Hello, I newbie in phaser, I coding a game words. The words are displayed and then illuminated one by one. Each time a word is turned on, after this word turn off, and the next one turns on.. I try this but don't work_ this.game.time.events.repeat(level.time2, level.highlightNum, function (){ texts[counter].fill = "black"; this.game.time.events.repeat(level.time2, 1, function (){ texts[counter].fill = "orange"; }, this); counter++; }, this); I try too, with javascript only, but it does not work either: for(var x = 0;x<level.highlightNum;x++){ setTimeout(function() { texts[counter].fill = "black"; counter++; console.log('counter: ', counter); }, 500); } I don't know what to try. Thanx in advance. Mauri (sorry for my english)