package graphic; import processing.core.*; public class BossBullet { PApplet p; PVector pos, vel; //PVector to store position and velocity valuse int radius = 7; // constant radius of bullet factor public BossBullet(PApplet p,PVector pos, PVector vel){ this.p = p; 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 p.fill(255, 0, 128); // design for bullet p.ellipse(pos.x, pos.y, 2, 2); } // check collision or not, return a boolean boolean collision(Moving other) { if ( p.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); } }