HTML and CSS Reference
In-Depth Information
13. When the canvas is resized, we reposiion the two customer queues with the
following method:
// 0.35 and 0.8 positions shows both queues in better spacing.
var leftPos = 0.35;
var rightPos = 0.8;
function repositionCustomer() {
game.view.queueLeft.x = game.canvas.width * leftPos;
game.view.queueLeft.y = game.canvas.height;
game.view.queueRight.x = game.canvas.width * rightPos;
game.view.queueRight.y = game.canvas.height;
}
Objective complete - mini debriefing
The following figure explains how the customer view is represented in both data and view. In
view, we only see two customers at the most. However, in data, we generate more customers
and put them in queues. Once the customer at the irst posiion is served, we move the
second one to the front of the shop, and display the customer in the view.
 
Search WWH ::




Custom Search