// a class for bullet of boss class Bossbullet { // fields PVector pos, vel; //PVector to store position and velocity valuse int radius = 7; // constant radius of bullet factor Bossbullet (PVector pos, PVector vel) { this.pos = pos; this.vel = vel; } //update the physics for the character void update() { pos.add(vel); // add velocity to position image(bossbulletimg, pos.x, pos.y); //loading image fill(255, 0, 128); // design for bullet ellipse(pos.x, pos.y, 2, 2); } // check collision or not, return a boolean boolean collision(Moving other) { if ( dist(pos.x, pos.y, other.pos.x, other.pos.y) < radius + other.radius) { bosshit.play(0); return true; //collision } return false; //no collision } void boom() { //effects of hit image(boomimg, pos.x, pos.y); } }