Learn Intermediate OOP by Building a Platformer Game - Step 85

Tell us what’s happening:

What is the issue here, there is no typo and i can’t understand why it’s not right
player.position.x <= platform.position.x + platform.width - (player.width / 3)

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region


  platforms.forEach((platform) => {
    const collisionDetectionRules = [
      player.position.y + player.height <= platform.position.y,
      player.position.y + player.height + player.velocity.y >= platform.position.y,
      player.position.x >= platform.position.x - player.width / 2,
      player.position.x <= platform.position.x + platform.width - (player.width / 3)

    ];
  });


// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

Challenge Information:

Learn Intermediate OOP by Building a Platformer Game - Step 85

Just remove the parentheses around (player.width / 3), as they are not necessary. (The division operator automatically takes precedence in the ‘order of operations’ over the subtraction operator). Your code should then pass.

Thank you! It helped

1 Like