1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| int barWidth = 220; int barHeight = 30; int barInitiativeHeight = 6; Graphics2D g2 = (Graphics2D) g;
g2.setColor(new Color(73,73,73)); g2.fillRect(63, 450, barWidth-1, barHeight-1); g2.fillRect(523, 450, barWidth-1, barHeight-1); g2.setColor(new Color(91,91,91)); g2.drawRect(62, 449, barWidth, barHeight); g2.drawRect(522, 449, barWidth, barHeight);
g2.setPaint(new GradientPaint(0,0,new Color(234, 158,15),100, 0,new Color(251,181,15))); g2.fillRect(63, 450, (int) (barWidth*(player.getCharacters().get(0).getStamina()/(float)player.getCharacters().get(0).getMaxStamina())-1), barHeight-1); g2.setPaint(new GradientPaint(0,0,new Color(251,181,15),100, 0,new Color(234, 158,15))); g2.fillRect(523+(barWidth-(int)(barWidth*(enemies.get(0).getStamina()/(float)enemies.get(0).getMaxStamina()))), 450, (int) (barWidth*(enemies.get(0).getStamina()/(float)enemies.get(0).getMaxStamina())-1), barHeight-1); g2.setColor(new Color(73,73,73)); g2.fillRect(26, 434, barWidth-1, barHeight-1); g2.fillRect(63, 482, barWidth-1, barInitiativeHeight-1); g2.fillRect(558, 434, barWidth-1, barHeight-1); g2.fillRect(523, 482, barWidth-1, barInitiativeHeight-1); g2.setColor(new Color(91,91,91)); g2.drawRect(25, 433, barWidth, barHeight); g2.drawRect(62, 481, barWidth, barInitiativeHeight); g2.drawRect(557, 433, barWidth, barHeight); g2.drawRect(522, 481, barWidth, barInitiativeHeight);
g2.setPaint(new GradientPaint(0,0,new Color(17,118,0),100, 0,new Color(57,160,40))); g2.fillRect(25, 433, (int) (barWidth*(player.getCharacters().get(0).getHealthPoint()/(float)player.getCharacters().get(0).getMaxHealthPoint())), barHeight); g2.setPaint(new GradientPaint(0,0,new Color(57,160,40),100, 0,new Color(17,118,0))); g2.fillRect(557+(int) (barWidth-(barWidth*(enemies.get(0).getHealthPoint()/(float)enemies.get(0).getMaxHealthPoint()))),433, (int) (barWidth*(enemies.get(0).getHealthPoint()/(float)enemies.get(0).getMaxHealthPoint())), barHeight);
g2.setColor(new Color(255,93,25)); g2.fillRect(63, 482, (int) (barWidth*(player.getCharacters().get(0).getTurnTimer() / (float)CombatState.MAX_TURN_TIMER )-1), barInitiativeHeight-1); g2.fillRect(523+(int) (barWidth-(barWidth*(enemies.get(0).getTurnTimer() / (float)CombatState.MAX_TURN_TIMER ))),482, (int) (barWidth*(enemies.get(0).getTurnTimer() / (float)CombatState.MAX_TURN_TIMER )), barInitiativeHeight-1); |