Tell us what’s happening:
Describe your issue in detail here.
When the player moves to the right, you will need to adjust its velocity.
Use the addition assignment operator to add the velocity’s x
coordinate to the player’s x
position.
Don’t forget to include the this
keyword for the velocity and position.
I keep getting this error =>
You should use the addition assignment operator +=
to add the velocity’s x
coordinate to the player’s x
position.
Your code so far
update() {
this.draw();
this.velocity.x += this.position.x;
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Challenge Information:
Learn Intermediate OOP by Building a Platformer Game - Step 21