update lighting logic to extend night duration and enhance gradient color customization
This commit is contained in:
@@ -61,7 +61,7 @@ public class Lighting {
|
||||
}
|
||||
case NIGHT -> {
|
||||
dayCount++;
|
||||
if (dayCount > 600) { //10 seconds
|
||||
if (dayCount > 36000) { //10 minutes
|
||||
dayState = DayState.DAWN;
|
||||
dayCount = 0;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class Lighting {
|
||||
int centerX = panel.player.screenX + panel.tileSize/2;
|
||||
int centerY = panel.player.screenY + panel.tileSize/2;
|
||||
|
||||
RadialGradientPaint gPaint = getRadialGradientPaint(centerX, centerY);
|
||||
RadialGradientPaint gPaint = getRadialGradientPaint(centerX, centerY, 0F,0F, 0.1F);
|
||||
g2.setPaint(gPaint);
|
||||
|
||||
g2.fillRect(0, 0, panel.screenWidth, panel.screenHeight);
|
||||
@@ -92,20 +92,20 @@ public class Lighting {
|
||||
}
|
||||
|
||||
// UTILITY
|
||||
private RadialGradientPaint getRadialGradientPaint(int centerX, int centerY) {
|
||||
private RadialGradientPaint getRadialGradientPaint(int centerX, int centerY, float r, float g, float b) {
|
||||
Color[] color = new Color[] {
|
||||
new Color(0, 0, 0, 0.1f),
|
||||
new Color(0, 0, 0, 0.42f),
|
||||
new Color(0, 0, 0, 0.52f),
|
||||
new Color(0, 0, 0, 0.61f),
|
||||
new Color(0, 0, 0, 0.69f),
|
||||
new Color(0, 0, 0, 0.76f),
|
||||
new Color(0, 0, 0, 0.82f),
|
||||
new Color(0, 0, 0, 0.87f),
|
||||
new Color(0, 0, 0, 0.91f),
|
||||
new Color(0, 0, 0, 0.94f),
|
||||
new Color(0, 0, 0, 0.96f),
|
||||
new Color(0, 0, 0, 0.97f)
|
||||
new Color(r, g, b, 0.1f),
|
||||
new Color(r, g, b, 0.42f),
|
||||
new Color(r, g, b, 0.52f),
|
||||
new Color(r, g, b, 0.61f),
|
||||
new Color(r, g, b, 0.69f),
|
||||
new Color(r, g, b, 0.76f),
|
||||
new Color(r, g, b, 0.82f),
|
||||
new Color(r, g, b, 0.87f),
|
||||
new Color(r, g, b, 0.91f),
|
||||
new Color(r, g, b, 0.94f),
|
||||
new Color(r, g, b, 0.96f),
|
||||
new Color(r, g, b, 0.97f)
|
||||
};
|
||||
|
||||
final int lim = 3;
|
||||
|
||||
Reference in New Issue
Block a user