Have a faded life total over the avatar which glows then fades again reddish for damage and bluish for life gain.

This commit is contained in:
spjspj 2018-03-29 00:28:56 +11:00
parent 08ffbecdb4
commit 938ac35981
2 changed files with 7 additions and 5 deletions

View file

@ -52,7 +52,7 @@ public class HoverButton extends JPanel implements MouseListener {
private Command onHover = null;
private Color textColor = Color.white;
private final Rectangle centerTextArea = new Rectangle(5, 18, 75, 40);
private Color centerTextColor = Color.YELLOW;
private Color centerTextColor = new Color(200, 190, 0, 180);
private final Color textBGColor = Color.black;
static final Font textFont = new Font("Arial", Font.PLAIN, 12);

View file

@ -202,10 +202,11 @@ public class PlayerPanelExt extends javax.swing.JPanel {
if (playerLife > pastLife) {
if (faderGainLife == null && doGainFade) {
doGainFade = false;
faderGainLife = new Timer(25, new ActionListener() {
faderGainLife = new Timer(50, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
gainX++;
avatar.setCenterColor(new Color(2 * gainX, 190, 255, 250 - gainX));
int alpha = Math.max(250 - gainX, 180);
avatar.setCenterColor(new Color(2 * gainX, 190, 255, alpha));
avatar.repaint();
if (gainX >= 100) {
avatar.setCenterColor(new Color(200, 190, 0, 180));
@ -227,10 +228,11 @@ public class PlayerPanelExt extends javax.swing.JPanel {
} else if (playerLife < pastLife) {
if (faderLoseLife == null && doLoseFade) {
doLoseFade = false;
faderLoseLife = new Timer(25, new ActionListener() {
faderLoseLife = new Timer(50, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
loseX++;
avatar.setCenterColor(new Color(250 - loseX / 2, 140 + loseX / 2, 0, 250 - loseX));
int alpha = Math.max(250 - loseX, 180);
avatar.setCenterColor(new Color(250 - loseX / 2, 140 + loseX / 2, 0, alpha));
avatar.repaint();
if (loseX >= 100) {
avatar.setCenterColor(new Color(200, 190, 0, 180));