mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): clarify player width division in Platformer Game (#61429)
Co-authored-by: Anna <a.rcottrill521@gmail.com>
This commit is contained in:
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-84
|
||||
|
||||
# --description--
|
||||
|
||||
Below that boolean expression, add another boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width.
|
||||
Below that boolean expression, add another boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. Use the division operator (`/`) to calculate half of the player's width.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width.
|
||||
You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus the player's width divided by `2`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+collisionDetectionRules\s*=\s*\[\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*platform\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*\+\s*player\.velocity\.y\s*>=\s*platform\.position\.y\s*,\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*\(?player\.width\s*\/\s*2\)?\s*,?\s*]\s*;?/);
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-85
|
||||
|
||||
# --description--
|
||||
|
||||
Add one last boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position plus the platform's width minus one-third of the player's width.
|
||||
Add one last boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position plus the platform's width minus one-third of the player's width. Use the division operator (`/`) to calculate a third of the player's width.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-88
|
||||
|
||||
# --description--
|
||||
|
||||
Inside that array, add a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width.
|
||||
Inside that array, add a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. Use the division operator (`/`) to calculate half of the player's width.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width.
|
||||
You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus the player's width divided by `2`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+platformDetectionRules\s*=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,?\s*\]\s*;?/)
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-89
|
||||
|
||||
# --description--
|
||||
|
||||
Below that boolean expression, add another boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position plus the platform's width minus one-third of the player's width.
|
||||
Below that boolean expression, add another boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position plus the platform's width minus one-third of the player's width. Use the division operator (`/`) to calculate a third of the player's width.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position and the platform's width minus one third of the player's width.
|
||||
You should have a boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position and the platform's width minus the player's width divided by `3`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+platformDetectionRules\s*=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3\s*,?\s*\]\s*;?/)
|
||||
|
||||
Reference in New Issue
Block a user