From 7bc5ab12ea05b3f9de7e49c39aa64cb03f1c383c Mon Sep 17 00:00:00 2001 From: s-chenrob Date: Thu, 5 Apr 2018 11:22:18 -0700 Subject: [PATCH] Better particles --- src/game/Particle.java | 3 ++- src/game/RhythmState.java | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game/Particle.java b/src/game/Particle.java index 995f926..f209929 100644 --- a/src/game/Particle.java +++ b/src/game/Particle.java @@ -26,7 +26,8 @@ public int getRadius() { } public Color getColor() { - return new Color(0, 255, 0, 155 - tick); + return clicked ? new Color(0, 255, 0, 155 - tick) + : new Color(255, 0, 0, 155 - tick); } /** diff --git a/src/game/RhythmState.java b/src/game/RhythmState.java index 19dd117..a6ac40c 100644 --- a/src/game/RhythmState.java +++ b/src/game/RhythmState.java @@ -259,6 +259,8 @@ public void update(GameContainer gc, StateBasedGame sbg, int delta) if (!hitobject.clicked) { combo = 0; } + particles.add(new Particle(hitobject.x, hitobject.y, hitobject.radius, + hitobject.duration, hitobject.clicked)); hitobjects.remove(index); hitobjectscompleted++; hitpercent = (float) (Math.floor(10000 * points / hitobjectscompleted) @@ -290,11 +292,12 @@ public void click() { hitobjects.set(hitobjects.indexOf(hitobject), new HitObject(hitobject.x, hitobject.y, hitobject.radius, hitobject.duration, true)); if (Math.abs(hitobject.duration) <= LENIENCE_TIME) { - points++; // increments points + // Formula: Base score of a hit + Base score of a hit + // * (Combo multiplier * Difficulty multiplier * Mod multiplier) / 25 + points += 50 + 50 * (combo * 0.5 * 1) / 25; // increments points perfection += 1.0 - Math.abs(hitobject.duration) / LENIENCE_TIME; combo++; // increases combo } - particles.add(new Particle(hitobject.x, hitobject.y, hitobject.radius, hitobject.duration, false)); break; // breaks out of loop so that only one hit object is clicked at // once }