{"id":74,"date":"2015-02-13T17:29:24","date_gmt":"2015-02-13T17:29:24","guid":{"rendered":"http:\/\/buildanhtml5game.com\/?page_id=74"},"modified":"2015-02-13T17:29:24","modified_gmt":"2015-02-13T17:29:24","slug":"chapter-3-exercise-2-experimental-board-layouts","status":"publish","type":"page","link":"http:\/\/buildanhtml5game.com\/?page_id=74","title":{"rendered":"Chapter 3, Exercise 2 &#8211; Experimental Board Layouts"},"content":{"rendered":"<p><em>Now that you can make createLayout build a different grid pattern, write code to generate an entirely new layout. For example, you could draw only every alternate column or build a more creative layout.<\/em><\/p>\n<p>One simple change is to add spaces between bubbles by changing createLayout in board.js:<\/p>\n<p><code>var createLayout = function(){<br \/>\n&nbsp;&nbsp;var rows = [];<br \/>\n&nbsp;&nbsp;for(var i=0;i&lt;NUM_ROWS;i++){<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;var row = [];<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;var startCol = i%2 == 0 ? 1 : 0;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;for(var j=startCol;j&lt;NUM_COLS;j+=3){<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var bubble = BubbleShoot.Bubble.create(i,j);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row[j] = bubble;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;};<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;rows.push(row);<br \/>\n&nbsp;&nbsp;};<br \/>\n&nbsp;&nbsp;return rows;<br \/>\n};<\/code><\/p>\n<p>Again, this doesn&#8217;t look like it&#8217;s going to make the game particularly easy.<\/p>\n<p><a href=\"http:\/\/buildanhtml5game.com\/wp-content\/uploads\/2015\/02\/Ex_3_2.png\"><img decoding=\"async\" src=\"http:\/\/buildanhtml5game.com\/wp-content\/uploads\/2015\/02\/Ex_3_2.png\" alt=\"Bubble Shooter Sparse Layout\" width=\"960\" class=\"alignnone size-full wp-image-75\" srcset=\"http:\/\/buildanhtml5game.com\/wp-content\/uploads\/2015\/02\/Ex_3_2.png 1000w, http:\/\/buildanhtml5game.com\/wp-content\/uploads\/2015\/02\/Ex_3_2-300x221.png 300w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that you can make createLayout build a different grid pattern, write code to generate an entirely new layout. For example, you could draw only every alternate column or build a more creative layout. One simple change is to add spaces between bubbles by changing createLayout in board.js: var createLayout = function(){ &nbsp;&nbsp;var rows = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":22,"menu_order":32,"comment_status":"open","ping_status":"open","template":"practice-answer-page.php","meta":[],"_links":{"self":[{"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/pages\/74"}],"collection":[{"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":1,"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/pages\/74\/revisions"}],"predecessor-version":[{"id":76,"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/pages\/74\/revisions\/76"}],"up":[{"embeddable":true,"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=\/wp\/v2\/pages\/22"}],"wp:attachment":[{"href":"http:\/\/buildanhtml5game.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}