Hmm...less than 34 hours to complete Shield Bearer for the contest. Hopefully, tonight will be just like yesterday. Okay, let's get a Heads Up Display (HUD) going to display the player's current score and their Health Bar. I wanted to get the score going first, so I looked up how to draw text using the HTML5 canvas context . I then read up on the JavaScript classes , because I wanted to know if I could create a static class just to display the score. I can: if I add the word "static" before the function in the class, it becomes a static function that can be called right from the class without creating an instance of that class. I gave it a static draw() function, and made a few const variables to hold the color that I wanted for the text. I then added it to my main draw() function to get the score to draw on the Canvas. I had to change the x and y variables around to fully display the text, but I got it in an area that I like. Now, we need a...
Comments
Post a Comment