Skip to content

Commit

Permalink
Better particles
Browse files Browse the repository at this point in the history
  • Loading branch information
chen-robert committed Apr 5, 2018
1 parent 64cd607 commit 7bc5ab1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/game/Particle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
7 changes: 5 additions & 2 deletions src/game/RhythmState.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 7bc5ab1

Please sign in to comment.