HTML and CSS Reference
In-Depth Information
The following figure shows how we put two containers in the customer view. The queues
in view are containers with their posiion deined. The beneit is that we don't need to
handle the posiion of the customer. We just need to add the customer sprite into the
correct queue container.
Resizing the canvas
First, we listen for the element resize event. Then, we reposiion customers based on the
new game dimension. Since all customer sprites are added to either the left or right queue
container, we only need to reposiion these two containers. The let queue is 35 percent
from the left edge and the right queue is 80 percent from the left edge.
Refilling sushi ingredients
In this task, we will control the ingredients' amounts and refill. We will also introduce
a currency.
Engage thrusters
In these steps, we will polish the game with a cash mechanism:
1. We store the cash value in the data.js file:
game.cash = 1000;
2. In the view.js file, we define a corresponding refresh method:
var cashNode = document.getElementById('status-bar');
game.view.refreshCash = function(){
cashNode.textContent = '$' + game.cash;
}
 
Search WWH ::




Custom Search