Skip to content

Commit d23111a

Browse files
committed
update: collision method params
1 parent e10ed9a commit d23111a

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

obstacle.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
class Obstacle {
22
constructor() {
33
this.pos = createVector(
4-
random(50, width), random(50, height/2))
4+
random(50, width),
5+
random(50,height / 2)
6+
)
57
this.r = 60
68
}
7-
9+
810
reset() {
911
this.pos = createVector(
10-
random(50, width), random(50, height/2))
12+
random(50, width),
13+
random(50, height / 2)
14+
)
1115
}
12-
16+
1317
show() {
1418
noStroke()
1519
ellipse(this.pos.x, this.pos.y, this.r)
1620
}
17-
18-
hitLeft(lw, i) {
21+
22+
collisionWrist(wristX, wristY, i) {
1923
let hit = collideCircleCircle(
20-
lw.x, lw.y, 20,
21-
obstacles[i].pos.x, obstacles[i].pos.y, this.r)
24+
wristX, wristY, 20,
25+
obstacles[i].pos.x, obstacles[i].pos.y, this.r
26+
)
2227
return hit
2328
}
24-
25-
hitRight(rw, i) {
26-
let hit = collideCircleCircle(
27-
rw.x, rw.y, 20,
28-
obstacles[i].pos.x, obstacles[i].pos.y, this.r)
29-
return hit
30-
}
31-
}
29+
}

0 commit comments

Comments
 (0)