Spaces:
Running
Running
can you make the hitbox of thcar smaller than it is now
Browse files239 unmodified lines240241242243244245246247248249250251252253239 unmodified linesisOffScreen() {return this.y > canvas.height;}collidesWith(gorilla) {return this.x < gorilla.x + gorilla.width &&this.x + this.width > gorilla.x &&this.y < gorilla.y + gorilla.height &&this.y + this.height > gorilla.y;}}// Road line classclass RoadLine {239 unmodified lines240241242243244245246247248249250251252253254255256239 unmodified linesisOffScreen() {return this.y > canvas.height;}collidesWith(gorilla) {// Make hitbox smaller by adding padding (20% smaller on all sides)const hitboxPaddingX = this.width * 0.2;const hitboxPaddingY = this.height * 0.2;return (this.x + hitboxPaddingX) < (gorilla.x + gorilla.width) &&(this.x + this.width - hitboxPaddingX) > gorilla.x &&(this.y + hitboxPaddingY) < (gorilla.y + gorilla.height) &&(this.y + this.height - hitboxPaddingY) > gorilla.y;}}// Road line classclass RoadLine {
index.html+9-6