Learn Intermediate OOP by Building a Platformer Game - Step 46

Tell us what’s happening: i am stuck with this

Your code so far

if (rightKey && this.position.x > proportionalSize(400)) {

}

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

Learn Intermediate OOP by Building a Platformer Game - Step 46

Welcome to the forum @Hamzakhan

First you need to access the keys object, then the righthKey key, then pressed.

  rightKey: {
    pressed: false
  },

Secondly, replace the this keyword with player as that how the variable was constructed.

Finally, replace the greater than sign with a less than sign.

Happy coding

2 Likes

ya i got it thanks for the help ;

my code so far can you please check
if(keys.leftKey.pressed && player.position.x < proportionalSize(400) ) {
}

Use rightKey not leftKey

ok thanks
for the help

1 Like

Thank you Teller! The “hint” was very unhelpful in this step as to what is needed here – just repeating the instruction almost verbatum.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.