File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -847,13 +847,13 @@ and a size) touches a grid element of the given type.
847847
848848``` {includeCode: true}
849849Level.prototype.touches = function(pos, size, type) {
850- var xStart = Math.floor(pos.x);
851- var xEnd = Math.ceil(pos.x + size.x);
852- var yStart = Math.floor(pos.y);
853- var yEnd = Math.ceil(pos.y + size.y);
850+ let xStart = Math.floor(pos.x);
851+ let xEnd = Math.ceil(pos.x + size.x);
852+ let yStart = Math.floor(pos.y);
853+ let yEnd = Math.ceil(pos.y + size.y);
854854
855- for (var y = yStart; y < yEnd; y++) {
856- for (var x = xStart; x < xEnd; x++) {
855+ for (let y = yStart; y < yEnd; y++) {
856+ for (let x = xStart; x < xEnd; x++) {
857857 let isOutside = x < 0 || x >= this.width ||
858858 y < 0 || y >= this.height;
859859 let here = isOutside ? "wall" : this.rows[y][x];
Original file line number Diff line number Diff line change @@ -93,6 +93,11 @@ <h2>Chapter 15</h2>
9393
9494< h2 > Chapter 16</ h2 >
9595
96+ < p > < strong > Page 278</ strong > < em > Motion and Collision</ em > : The code
97+ that defines the < code > touches</ code > method unintentionally (though
98+ harmlessly) used < code > var</ code > instead of < code > let</ code > to
99+ define variables.</ p >
100+
96101< p > < strong > Page 285</ strong > (2nd) < em > Pausing the Game</ em > : The text
97102refers to the < code > arrow</ code > binding, where it should
98103say < code > arrowKeys</ code > .</ p >
You can’t perform that action at this time.
0 commit comments