class CheckMote extends Particle { CheckMote(PVector pos, PVector vel, int life) { super(pos, vel, life); } void draw() { colorMode(HSB); noStroke(); fill((phys_frame * 5)%256, 64, 255); ellipse(pos.x, pos.y, 3*life/maxlife + 0.5, 3*life/maxlife + 0.5); colorMode(RGB); } } class StartMote extends Particle { StartMote(PVector pos, PVector vel, int life) { super(pos, vel, life); } void draw() { noStroke(); fill(255); ellipse(pos.x, pos.y, 3*life/maxlife + 0.5, 3*life/maxlife + 0.5); } } class Wall extends Particle { Wall() { super(new PVector(invisiwall, 0), new PVector(0, 0), 30); } Wall(float x) { super(new PVector(x, 0), new PVector(0, 0), 30); } void draw() { stroke(255, 255*life/maxlife); strokeWeight(2); line(pos.x, cam.y, pos.x, cam.y+height); } } class ShinyTrail extends Particle { ShinyTrail() { super(PVector.add(player_pos, randomVector(5)), new PVector(0, 0), 60); } void draw() { colorMode(HSB); noStroke(); fill((phys_frame * 5)%256, 64, 255); ellipse(pos.x, pos.y, 10 * life / maxlife, 10 * life / maxlife); colorMode(RGB); } } class SimpleTrail extends Particle { SimpleTrail() { super(PVector.add(player_pos, randomVector(3)), new PVector(0, 0), 60); } void draw() { noFill(); stroke(255); strokeWeight(1); if(pos.y < WATER_LEVEL) { stroke(255, 255, random(255)); float r = 5.0*life/maxlife; line(pos.x-r, pos.y, pos.x+r, pos.y); line(pos.x, pos.y-r, pos.x, pos.y+r); } else { stroke(random(255), 255, 255); ellipse(pos.x, pos.y, 5 * life / maxlife, 5 * life / maxlife); } } } class Poom extends Particle { Poom() { super(player_pos, new PVector(0, 0), 30); } void draw() { noFill(); noStroke(); fill(255, 255*life/maxlife); //strokeWeight(2); float r = 40 - 40*life/maxlife; ellipse(player_pos.x, player_pos.y, r, r); } } class Droplet extends Particle { Droplet() { super(PVector.add(player_pos, randomVector(3)), PVector.add(PVector.mult(player_vel, random(2)), randomVector(random(player_vel.mag()/8))), 180); vel.mult(1); } void tick() { if(pos.y > WATER_LEVEL) { vel.y -= 0.3; vel.mult(0.95); } else { vel.y += 0.015; vel.mult(0.99); } super.tick(); } void draw() { noStroke(); fill(255, 255*(2*life/maxlife + random(2) - 1)); ellipse(pos.x, pos.y, 2, 2); } } class StarGrab extends Particle { StarGrab(PVector pos) { super(pos, new PVector(0, 0), 60); } void draw() { noStroke(); colorMode(HSB); fill((phys_frame * 5)%256, 64, 255); ellipse(pos.x, pos.y, STAR_RADIUS * life / maxlife + 5, STAR_RADIUS * life / maxlife + 5); colorMode(RGB); } void tick() { PVector to_player = PVector.sub(player_pos, pos); to_player.div(life/4 + 1); pos.add(to_player); super.tick(); } } class Starburst extends Particle { int spokes; Starburst(int sides) { super(player_pos, new PVector(0, 0), 180); spokes = sides; } void draw() { colorMode(HSB); stroke((phys_frame * 5)%256, 64, 255); strokeWeight(10 * life / maxlife); float theta = phys_frame * 0.02; float radi = 3000 - 3000*life/maxlife; for(int i = 0; i < spokes; i++) { float angle = theta + i*TWO_PI/spokes; line(pos.x, pos.y, pos.x + radi * cos(angle), pos.y + radi * sin(angle)); } noFill(); ellipse(pos.x, pos.y, radi/2, radi/2); colorMode(RGB); } } class Ring extends GameObject { boolean tagged; Ring(PVector p) { pos = p.get(); radius = RING_RADIUS; tagged = false; } void tick() { if(inRadius(player_pos, pos, radius)) { tagged = true; if(poom_timer == 0) { //removal_flag = true; //if(!muted) aceSound.trigger(); float speed = player_vel.mag(); speed += RING_BOOST; if(speed < RING_MIN_BOOST) speed = RING_MIN_BOOST; PVector toward = PVector.sub(pos, player_pos); toward.normalize(); toward.mult(speed); player_vel = toward; // player_vel.y = min(-abs(player_vel.y) - 0.5, -1.5); // player_vel.x += 0.5; } } else { //if(tagged) removal_flag = true; } if(inRadius(player_pos, pos, STAR_RADIUS) && poom_timer <= POOM_TIME) { removal_flag = true; particles.add(new StarGrab(pos)); if(!muted) grabSound.trigger(); star_chain++; } //if(pos.x + radius < cam.x - RING_LEAD) removal_flag = true; if(pos.x < invisiwall) removal_flag = true; } void draw() { noFill(); strokeWeight(2); colorMode(HSB); stroke((phys_frame * 5)%256, 64, 255, 128); ellipse(pos.x, pos.y, radius, radius); noStroke(); fill((phys_frame * 5)%256, 64, 255); regStar(pos.x, pos.y, STAR_RADIUS, 5, phys_frame * 0.02); colorMode(RGB); } } void regStar(float x, float y, float r, int sides, float rot) { beginShape(); for(int i = 0; i < sides; i++) { float segAngle = TWO_PI/sides * 2; vertex(cos(i*segAngle + rot) * r + x, sin(i*segAngle + rot) * r + y); } endShape(CLOSE); }