freeCodeCamp
freeCodeCamp copied to clipboard
platformer game (js beta) step 84 and step 88 (and step 89) check is too strict
Describe the Issue
In the platformer game's (js beta) step 84 (and step 88), the step expects us to write this new line of code
player.position.x >= platform.position.x - player.width / 2
but doesn't accept this equally valid variation (at least in my view, it is valid):
player.position.x >= platform.position.x - (0.5 * player.width)
When we provide the variation above, the hint also does not provide any help to direct us to what it needs us to write. (Note that the instructions also do not make mention of a specific method for getting "half of the player's width" so it is open to interpretation there too) please note other steps have similar issues but with different numbers (like step 89)
Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-84 https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-88 https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-89
Your code
as above.
Expected behavior
Either fix the check to allow users to multiply by 0.5 (in addition to divide by 2) or update the text of the step and the hints to be more explicit about a division operator being a requirement to finding half the width.
Screenshots
No response
System
N/A
Additional context
There's a similar problem in step 85, but it is mitigated there by the hint which actually says that we should divide by 3. (on my first attempt, I multiplied by 1/3 which was not accepted)
Also whatever fix is done for step 84 should apply to step 88 too as they have the same issue. Please also look at updating step 89 checks/hints as well to match whatever decision is reached here. (either update the hint to be like step 85 and say that division is required or update the step's checks to allow multiplication by 1/3)