fix(curriculum): clarify player width division in Platformer Game (#61429)

Co-authored-by: Anna <a.rcottrill521@gmail.com>
This commit is contained in:
Supravisor
2025-07-25 12:37:28 +12:00
committed by GitHub
parent 5b41229da3
commit 35bfcdebf7
4 changed files with 7 additions and 7 deletions
@@ -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*;?/);
@@ -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--
@@ -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*;?/)
@@ -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*;?/)