Learn Intermediate OOP by Building a Platformer Game - Step 99

Tell us what’s happening:

I’m returning to this lesson after a while off. How to give my checkpoint class a claim method? The error message says “your checkpoint class should have a claim message”. Thanks!

Your code so far

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

/* file: styles.css */

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


class CheckPoint {
  constructor(x, y, z) {
    this.position = {
      x,
      y,
    };
    this.width = proportionalSize(40);
    this.height = proportionalSize(70);
    this.claimed = false;
   //this line down is what I added for this lesson
this.claim ={
     this.width = 0
     this.height =0
     this.position.y = Infinity
     this.claimed =true
   }
 
  };

  draw() {
    ctx.fillStyle = "#f1be32";
    ctx.fillRect(this.position.x, this.position.y, this.width, this.height);
  }

};


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0

Challenge Information:

Learn Intermediate OOP by Building a Platformer Game - Step 99

The class already has a draw() method, you can use that as a guide.

Thank you! That helped me get it.

1 Like