Jump to content

Unable to change the color of BitmapText


jayantbh
 Share

Recommended Posts

I'm following the melonJS guides on space invaders and platformer.

Tried to add a HUD component with score on it. Obtained the font files from their github: https://github.com/melonjs/tutorial-platformer/tree/28425a946836e21e58e8fbc443f380b990e7f527/tutorial_step6/data/fnt

 

The text does show up, but it appears white, and I can't change the color on it.

This is what I've tried:

// 1
this.font = new me.BitmapText(0, 0, {
  font: "PressStart2P",
  fillStyle: "#000000",
  textAlign: "right",
  textBaseline: "bottom",
});

// 2
this.font.tint.setColor(255, 128, 128);

// 3
this.font.fillStyle = "#000000" (and "#000", and "black")

// 4
this.font.fillStyle = me.Color(0, 0, 0);

 

What am I doing wrong?

Link to comment
Share on other sites

  • 4 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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