Skip to content

Commit

Permalink
Merge pull request #871 from nature-of-code/notion-update-docs
Browse files Browse the repository at this point in the history
one change in chapter 4 + codesplit allowbreak test
  • Loading branch information
shiffman authored Feb 27, 2024
2 parents 7d2f0cb + 6b5df73 commit 15dce0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion content/01_vectors.html
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ <h2 id="motion-with-vectors">Motion with Vectors</h2>
<p>The <code>Mover</code> class also needs a function that determines what the object should do when it reaches the edge of the canvas. For now, I’ll do something simple and have it wrap around the edges:</p>
<div class="snip-above">
<pre class="codesplit" data-code-language="javascript"> checkEdges() {
//{!5} When it reaches one edge, set the position to the other edge.
//{!11.allow-break} When it reaches one edge, set the position to the other edge.
if (this.position.x > width) {
this.position.x = 0;
} else if (this.position.x &#x3C; 0) {
Expand Down
4 changes: 3 additions & 1 deletion content/04_particles.html
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,9 @@ <h3 id="particles-with-inheritance-and-polymorphism">Particles with Inheritance
circle(this.position.x, this.position.y, 8);
}
}</pre>
<p>The class has variables and methods that any participant in a particle system should have. Next, I’ll create a <code>Confetti</code> subclass that extends <code>Particle</code>. It will use <code>super()</code> to execute the code from the parent class’s constructor and will inherit most of the <code>Particle</code> class’s methods as well. However, I’ll give <code>Confetti</code> its own <code>show()</code> method, overriding that of its parent, so <code>Confetti</code> objects will be drawn as squares rather than circles:</p>
<div class="avoid-break">
<p>The class has variables and methods that any participant in a particle system should have. Next, I’ll create a <code>Confetti</code> subclass that extends <code>Particle</code>. It will use <code>super()</code> to execute the code from the parent class’s constructor and will inherit most of the <code>Particle</code> class’s methods as well. However, I’ll give <code>Confetti</code> its own <code>show()</code> method, overriding that of its parent, so <code>Confetti</code> objects will be drawn as squares rather than circles:</p>
</div>
<pre class="codesplit" data-code-language="javascript">class Confetti extends Particle {
constructor(x, y) {
super(x, y);
Expand Down

0 comments on commit 15dce0a

Please sign in to comment.