mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): order of math operations (#55494)
This commit is contained in:
+2
-2
@@ -220,8 +220,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -219,8 +219,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -241,8 +241,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -210,8 +210,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,8 +223,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -211,8 +211,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -217,8 +217,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -216,8 +216,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -245,8 +245,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -211,8 +211,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -221,8 +221,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -221,8 +221,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -222,8 +222,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -222,8 +222,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -221,8 +221,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -219,8 +219,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -221,8 +221,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -231,8 +231,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -237,8 +237,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -232,8 +232,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -213,8 +213,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -213,8 +213,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -214,8 +214,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -219,8 +219,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -232,8 +232,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -210,8 +210,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -216,8 +216,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -208,8 +208,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -236,8 +236,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,8 +223,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -211,8 +211,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -224,8 +224,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -219,8 +219,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -208,8 +208,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -224,8 +224,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -217,8 +217,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -214,8 +214,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -218,8 +218,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -231,8 +231,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -240,8 +240,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -237,8 +237,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -239,8 +239,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -225,8 +225,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,8 +223,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,8 +223,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,8 +223,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -235,8 +235,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -217,8 +217,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -226,8 +226,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -207,8 +207,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -209,8 +209,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -223,8 +223,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -219,8 +219,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,8 +648,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ dashedName: step-33
|
||||
|
||||
For the last condition, you will need to check if the player's `x` position has exceeded the right edge of the canvas. If it has, you will need to set the player's `x` position to the maximum value so the player does not accidentally go off screen to the right.
|
||||
|
||||
Inside your `update` method, create an `if` statement that checks if `this.position.x >= canvas.width - 2 * this.width`.
|
||||
Inside your `update` method, create an `if` statement that checks if `this.position.x >= canvas.width - this.width * 2`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -19,10 +19,10 @@ You should have an `if` statement inside your `update` method.
|
||||
assert.match(code, /if\s*\(\s*.*\s*\)\s*{/g);
|
||||
```
|
||||
|
||||
Your `if` statement should check if `this.position.x >= canvas.width - 2 * this.width`.
|
||||
Your `if` statement should check if `this.position.x >= canvas.width - this.width * 2`.
|
||||
|
||||
```js
|
||||
assert.match(code, /if\s*\(\s*this\.position\.x\s*>=\s*canvas\.width\s*-\s*2\s*\*\s*this\.width\s*\)\s*{/gi);
|
||||
assert.match(code, /if\s*\(\s*this\.position\.x\s*>=\s*canvas\.width\s*-\s*this\.width\s*\*\s*2\s*\)\s*{/gi);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+4
-4
@@ -7,16 +7,16 @@ dashedName: step-34
|
||||
|
||||
# --description--
|
||||
|
||||
Inside your `if` statement, assign `canvas.width - 2 * this.width` to `this.position.x`.
|
||||
Inside your `if` statement, assign `canvas.width - this.width * 2` to `this.position.x`.
|
||||
|
||||
This will ensure that the player's `x` position will never exceed the right edge of the canvas.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should assign `canvas.width - 2 * this.width` to `this.position.x` inside your `if` statement.
|
||||
You should assign `canvas.width - this.width * 2` to `this.position.x` inside your `if` statement.
|
||||
|
||||
```js
|
||||
assert.match(code, /this\.position\.x\s*=\s*canvas\.width\s*-\s*2\s*\*\s*this\.width;?/g);
|
||||
assert.match(code, /this\.position\.x\s*=\s*canvas\.width\s*-\s*this\.width\s*\*\s*2\s*;?/g);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -209,7 +209,7 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
--fcc-editable-region--
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -217,8 +217,8 @@ class Player {
|
||||
this.position.x = this.width;
|
||||
}
|
||||
|
||||
if (this.position.x >= canvas.width - 2 * this.width) {
|
||||
this.position.x = canvas.width - 2 * this.width;
|
||||
if (this.position.x >= canvas.width - this.width * 2) {
|
||||
this.position.x = canvas.width - this.width * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user