Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Adding multiple RetroFont lines?


Tilde
 Share

Recommended Posts

What I'm trying to do here is load a RetroFont once, then write various things on various parts of the screen. This is for my game's menu.

 

I've tried a bunch of different things, but no matter what I do, instead of writing various things to the screen, every image becomes the last-set message.

   computerScreen = this.add.image(0,0, 'computerScreen');   computerText = this.add.retroFont('computerFont', 4, 5, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890.,!?:@'\"^_-#+ ", 100, 1, 1);     //computerText.setText("Test 1!\nThe quick brown fox jumped over the lazy dog. No text wrapping!!!", true, 1, 1, Phaser.RetroFont.ALIGN_LEFT, true);   computerText.buildRetroFontText("Test 1!\nThe quick brown fox jumped over the lazy dog. No text wrapping!!!", 12, 41, 0);   missionStatement = game.add.image(12, 41, computerText);   computerText.setText(1, true, 1, 1, Phaser.RetroFont.ALIGN_LEFT, true);   missionNumber = this.add.image(210, 44, computerText);   //computerText.pasteLine("Mission Name", 210, 44, 1);   computerText.setText("Mission Name", true, 1, 1, Phaser.RetroFont.ALIGN_LEFT, true);   missionName = this.add.image(210, 44, computerText);   computerText.setText("TEREK-STAR\nYOA3805@2274", true, 1, 1, Phaser.RetroFont.ALIGN_LEFT, true);   //computerText.pasteLine("SOLO ARMADA\n22@789626PF", 166, 21, 1);   computerText.setText("0.0.1", false, 1, 1, Phaser.RetroFont.ALIGN_LEFT, true);   versionNumber = this.add.image(262, 204, computerText);

Check out the result here:

 

http://www.hardmodeorders.com/slapspark/slapspark.html

 

As you can see, it says "0.0.1" in a bunch of places, even though I only wanted that to show in the lower-right. What's the deal with this? Do I really have to add another retrofont for every single new message?

Link to comment
Share on other sites

I think that's the intent with RetroFont, to add a completely new instance for every instance of text you want to display. What you're seeing now is the intended behavior; the texture is getting updated in-place and updating across all the Phaser.Images you've added.

 

EDIT: One way to think of it is that it's not a "font", per se, it's a "text". If that helps.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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