Spaces:
Running
Running
can you make the hitbox of thcar smaller than it is now
Browse files239 unmodified lines240241242243243245246247248244245246247248249250251252250253254255256239 unmodified lines isOffScreen() { 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; // 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 class class RoadLine {index.html+9-6