Game Development Reference
In-Depth Information
The Fakezee button is for the best score you can get, so it's large and placed in the center of the two columns of
buttons. It's positioned and given the same custom properties as the rest of the score buttons, and it will be used in the
same ways. Its score will be added to section two, and clicking it will also call the onScoreCardBtnClick function.
The scoreMsg sprite is simply a graphical message that will sit on top of the text object scoreTxt , which will hold
the total score. Both are positioned and added to the stage. Figure 7-8 shows the stage with the scorecard added.
Figure 7-8. The complete scorecard container added to the stage
Building the Scoreboard
The scoreboard is the final group needed for the game. It will also be a container and will hold the scores for both
sections and bonus points scored when scoring multiple Fakezees (see Listing 7-16).
Listing 7-16. The buildScoreBoard Function Builds the Container to Hold the Game Scores
function buildScoreboard() {
var scoreBar, txt, xPos;
var padding = 5;
var sec1XPos = 12;
var sec2XPos = 145;
var bonusXPos = 280;
scoreboard = new createjs.Container();
scoreboard.x = SCOREBOARD_POSITION.x;
scoreboard.y = SCOREBOARD_POSITION.y;
//scoreboard.alpha = 0;
scoreBar = new createjs.Sprite(spritesheet, 'scoreBar');
scoreBar.name = 'scoreBar';
scoreboard.addChild(scoreBar);
 
Search WWH ::




Custom Search