@@ -363,7 +363,7 @@ time and motion inside them.
363
363
== Encapsulation as a burden ==
364
364
365
365
(((programming style)))(((program size)))(((complexity)))Most of the
366
- code in this chapter does not worry about ((encapsulation)) for
366
+ code in this chapter does not worry about ((encapsulation)). This has
367
367
two reasons. First, encapsulation takes extra effort. It makes
368
368
programs bigger and requires additional concepts and interfaces to be
369
369
introduced. Since there is only so much code you can throw at a reader
@@ -520,8 +520,8 @@ pixels.
520
520
DOMDisplay.prototype.drawActors = function() {
521
521
var wrap = elt("div");
522
522
this.level.actors.forEach(function(actor) {
523
- var rect = wrap.appendChild(elt("div", "actor " +
524
- actor.type));
523
+ var rect = wrap.appendChild(elt("div",
524
+ "actor " + actor.type));
525
525
rect.style.width = actor.size.x * scale + "px";
526
526
rect.style.height = actor.size.y * scale + "px";
527
527
rect.style.left = actor.pos.x * scale + "px";
@@ -535,8 +535,8 @@ DOMDisplay.prototype.drawActors = function() {
535
535
class, we separate the class names by spaces. In the
536
536
((CSS)) code shown next, the `actor` class gives the actors their
537
537
absolute position. Their type name is used as an extra class to give
538
- them a color. Lava actors don't need the extra class because they use
539
- the same class as lava grid squares, which we defined earlier.
538
+ them a color. We don't have to define the `lava` class again because we reuse
539
+ the class for the lava grid squares which we defined earlier.
540
540
541
541
[source,text/css]
542
542
----
@@ -587,7 +587,7 @@ element)) with a given class.
587
587
588
588
(((player)))(((box shadow (CSS))))After touching ((lava)), the
589
589
player's color turns dark red, suggesting scorching. When the last
590
- coin has been collected, we use two white box shadows, one to the top
590
+ coin has been collected, we use two blurred white box shadows, one to the top
591
591
left and one to the top right, to create a white halo effect.
592
592
593
593
[[viewport]]
@@ -720,7 +720,7 @@ Solving this for the general case is a big task. You can find
720
720
libraries, usually called _((physics engine))s_, that simulate
721
721
interaction between physical objects in two or three ((dimensions)).
722
722
We'll take a more modest approach in this chapter, handling only
723
- collisions between boxes and handling them in a rather simplistic
723
+ collisions between rectangular objects and handling them in a rather simplistic
724
724
way.
725
725
726
726
(((bouncing)))(((collision detection)))(((animation)))Before moving
@@ -1038,11 +1038,11 @@ missing now is the code that _drives_ the animation.
1038
1038
== Tracking keys ==
1039
1039
1040
1040
(((keyboard)))For a ((game)) like this, we do not want keys to take
1041
- effect once per press . Rather, we want their effect (moving the player
1041
+ effect once per keypress . Rather, we want their effect (moving the player
1042
1042
figure) to continue happening as long as they are pressed.
1043
1043
1044
1044
(((preventDefault method)))We need to set up a key handler that stores
1045
- the current state of the left, right, and up keys. We will also want
1045
+ the current state of the left, right, and up arrow keys. We will also want
1046
1046
to call `preventDefault` for those keys so that they don't end up
1047
1047
((scrolling)) the page.
1048
1048
@@ -1194,7 +1194,7 @@ called at the right moment.
1194
1194
1195
1195
(((asynchronous programming)))(((event handling)))This programming
1196
1196
style is usually called _asynchronous_ programming. Event handling is
1197
- also an instance of it , and we will see much more of it when working
1197
+ also an instance of this style , and we will see much more of it when working
1198
1198
with tasks that can take an arbitrary amount of ((time)), such as
1199
1199
((network)) requests in link:17_http.html#http[Chapter 17] and input
1200
1200
and output in general in link:20_node.html#node[Chapter 20].
0 commit comments