class Bullet { constructor(pos, angle) { this.pos = pos.copy(); this.vel = p5.Vector.fromAngle(angle); this.vel.mult(10); this.r = 4; } update() { this.pos.add(this.vel); } show() { push(); fill(255); noStroke(); ellipse(this.pos.x, this.pos.y, this.r * 2); pop(); } offscreen() { return (this.pos.x < 0 || this.pos.x > width || this.pos.y < 0 || this.pos.y > height); } }