Game Development Reference
In-Depth Information
stage.addChild(board);
livesTxt = new createjs.Text('lives: ' + lives, '20px Times', '#fff');
livesTxt.y = board.y + 10;
livesTxt.x = WALL_THICKNESS;
stage.addChild(livesTxt);
scoreTxt = new createjs.Text('score: ' + score, '20px Times', '#fff');
scoreTxt.textAlign = "right";
scoreTxt.y = board.y + 10;
scoreTxt.x = canvas.width - WALL_THICKNESS;
stage.addChild(scoreTxt);
messageTxt = new createjs.Text('press spacebar to pause', '18px Times',
'#fff');
messageTxt.textAlign = 'center';
messageTxt.y = board.y + 10;
messageTxt.x = canvas.width / 2;
stage.addChild(messageTxt);
}
Similarly to the walls, the message board is drawn at the very bottom edge of the stage. The text objects are then
drawn above this shape and positioned at the edges and center of the board. The score and lives text values will be
updated during the game loop, but are initially set to help with positioning and styling. Figure 4-2 demonstrates the
walls and game message board.
Figure 4-2. The walls and message board drawn to the stage
Search WWH ::




Custom Search