-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db1fd8d
commit 68fd220
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package game; | ||
|
||
import org.newdawn.slick.Color; | ||
|
||
/** | ||
* We assume that all particles can be rendered as a circle + color. | ||
* | ||
* @author s-chenrob | ||
* | ||
*/ | ||
public class Particle extends HitObject { | ||
protected int tick; | ||
|
||
public Particle(int x, int y, float radius, float duration, boolean clicked) { | ||
super(x, y, radius, duration, clicked); | ||
|
||
tick = 0; | ||
} | ||
|
||
public void update(int delta) { | ||
tick += delta / 2; | ||
} | ||
|
||
public int getRadius() { | ||
return tick / 2; | ||
} | ||
|
||
public Color getColor() { | ||
return new Color(0, 255, 0, 155 - tick); | ||
} | ||
|
||
/** | ||
* Return true if this particle should be disposed. | ||
* | ||
* @return | ||
*/ | ||
public boolean isDead() { | ||
return tick > 150; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters