class DeathDot extends Particle { color c; float r; DeathDot(PVector p, float ra) { super(p, PV(0,0), 120); float angle = PI/4 *int(random(3)+1); float magn = random(ra)-ra/2; vel=PV(cos(angle)*magn, sin(angle)*magn); c = color(random(255),random(255),random(255)); r = ra; } void draw() { fill(blendColors(color(c), color(255), life/float(maxlife)), 255*life/maxlife); noStroke(); ellipse(pos.x, pos.y, r*life/maxlife,r*life/maxlife); } } class FlingText extends Particle { String say; color col; FlingText(PVector p, String s, color c) { super(p, PVector.add(randomVector(0.5), PV(0, -1.5)), 180); col = c; say = s; } FlingText(PVector p, String s, color c, PVector v) { super(p, PVector.add(v, PV(0, -1)), 180); col = c; say = s; } void tick() { vel.y+=3.0/180; vel.mult(0.99); super.tick(); if(pos.x < 0) {pos.x = 0; vel.x *=-1;} if(pos.x > width) {pos.x = width; vel.x *=-1;} } void draw() { fill(col, 255*life/maxlife); textFont(info_font, 16); textAlign(CENTER, CENTER); text(say, pos.x, pos.y); } } int drama_dodge; class DramaticAnnouncement extends Particle { String label; DramaticAnnouncement(PVector p, String t) { super(p, new PVector(0, 0), 250); drama_dodge++; pos.y -= drama_dodge * 22; if(pos.x < 10*t.length()) pos.x = 10*t.length(); if(pos.x > width - 10*t.length()) pos.x = width - 10*t.length(); label = t; } void tick() { super.tick(); if(life==0) drama_dodge = 0; } void draw() { int len = label.length(); textFont(info_font, 16); textAlign(CENTER, CENTER); noStroke(); rectMode(RADIUS); fill(0, 64); float progress = map(life, 0, maxlife, -1, 1); float skew = pow(progress, 3); skew *= width; pushMatrix(); translate(pos.x-skew, pos.y); beginShape(); vertex(-8*len, -10); vertex(8*len+16, -10); vertex(8*len, 10); vertex(-8*len-16, 10); endShape(); popMatrix(); fill(255); text(label, pos.x+skew, pos.y); } } class DashRing extends Particle { DashRing(PVector pos) { super(pos, new PVector(0,0), 60); } void draw() { noFill(); strokeWeight(2); stroke(192, 100*life/maxlife); ellipseMode(RADIUS); ellipse(pos.x, pos.y, 100-100*life/maxlife, 100-100*life/maxlife); } } class GrandRing extends Particle { GrandRing(PVector pos) { super(pos, new PVector(0,0), 120); } void draw() { noFill(); strokeWeight(2); stroke(255, 120*life/maxlife); ellipseMode(RADIUS); ellipse(pos.x, pos.y, 200-200*life/maxlife, 200-200*life/maxlife); } } class WeaponTrail extends Particle { color c; float r; WeaponTrail(PVector pos, float rad, color col) { super(pos, new PVector(0, 0), 12); c = col; r = rad; } void draw() { noStroke(); fill(c); ellipse(pos.x, pos.y, r, r); } }