Chapter 3, Exercise 1 – Board Layouts
Each row of the game board is offset to form a staggered pattern. Change the code in createLayout so the bubbles form a regular grid. How will this change the game?
Change on line in the createLayout function in board.js:
var createLayout = function(){
var rows = [];
for(var i=0;i<NUM_ROWS;i++){
var row = [];
var startCol = 0;
for(var j=startCol;j<NUM_COLS;j+=2){
var bubble = BubbleShoot.Bubble.create(i,j);
row[j] = bubble;
};
rows.push(row);
};
return rows;
};
The grid is now regular and very odd looking, and it looks like it’s going to be much harder to join groups of bubbles together!
Leave a Reply