add Tent object and implement sleep functionality with lighting adjustments
This commit is contained in:
@@ -4,6 +4,7 @@ import de.miaurizius.jgame2d.core.enums.GameState;
|
||||
import de.miaurizius.jgame2d.entity.Entity;
|
||||
import de.miaurizius.jgame2d.entity.item.CoinObj;
|
||||
import de.miaurizius.jgame2d.entity.item.HeartObj;
|
||||
import de.miaurizius.jgame2d.environment.Lighting;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -25,7 +26,8 @@ public class UI {
|
||||
public int commandNum;
|
||||
public int playerSlotCol, playerSlotRow;
|
||||
public int npcSlotCol, npcSlotRow;
|
||||
private int transCounter;
|
||||
private int transCount;
|
||||
private int sleepCount;
|
||||
|
||||
// SUB-STATES
|
||||
public TradeState tradeState = TradeState.SELECT;
|
||||
@@ -64,6 +66,7 @@ public class UI {
|
||||
case GAMEOVER -> drawGameOverScreen();
|
||||
case TRANSITION -> drawTransitionScreen();
|
||||
case TRADE -> drawTradeScreen();
|
||||
case SLEEP -> drawSleepScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,11 +378,11 @@ public class UI {
|
||||
if(commandNum == 1) graphics2d.drawString(">", x-panel.tileSize, y);
|
||||
}
|
||||
private void drawTransitionScreen() {
|
||||
transCounter++;
|
||||
graphics2d.setColor(new Color(0,0,0, transCounter*5));
|
||||
transCount++;
|
||||
graphics2d.setColor(new Color(0,0,0, transCount *5));
|
||||
graphics2d.fillRect(0, 0, panel.screenWidth, panel.screenHeight);
|
||||
if(transCounter != 50) return;
|
||||
transCounter = 0;
|
||||
if(transCount != 50) return;
|
||||
transCount = 0;
|
||||
panel.gameState = GameState.PLAY;
|
||||
panel.currentMap = panel.eventH.tempMap;
|
||||
panel.player.worldX = panel.tileSize * panel.eventH.tempCol;
|
||||
@@ -395,6 +398,22 @@ public class UI {
|
||||
}
|
||||
panel.keyH.spacePressed = false;
|
||||
}
|
||||
private void drawSleepScreen() {
|
||||
sleepCount++;
|
||||
if(sleepCount < 120) {
|
||||
panel.eManager.lighting.filterAlpha += 0.01F;
|
||||
if(panel.eManager.lighting.filterAlpha >= 1F) panel.eManager.lighting.filterAlpha = 1F;
|
||||
}
|
||||
if(sleepCount >= 120) {
|
||||
panel.eManager.lighting.filterAlpha -= 0.01F;
|
||||
if(panel.eManager.lighting.filterAlpha <= 0F) {
|
||||
panel.eManager.lighting.filterAlpha = 0F;
|
||||
sleepCount = 0;
|
||||
panel.eManager.lighting.dayState = Lighting.DayState.DAY;
|
||||
panel.gameState = GameState.PLAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TRADING
|
||||
private void tradeSelect() {
|
||||
|
||||
@@ -13,5 +13,6 @@ public enum GameState {
|
||||
GAMEOVER,
|
||||
TRANSITION,
|
||||
TRADE,
|
||||
SLEEP,
|
||||
|
||||
}
|
||||
|
||||
@@ -40,25 +40,15 @@ public class AssetSetter {
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*28;
|
||||
i++;
|
||||
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i] = new PotionObj(panel);
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*21;
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*20;
|
||||
i++;
|
||||
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i] = new PotionObj(panel);
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*20;
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*20;
|
||||
i++;
|
||||
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i] = new PotionObj(panel);
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*17;
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*21;
|
||||
i++;
|
||||
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i] = new LanternObj(panel);
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*18;
|
||||
panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*20;
|
||||
i++;
|
||||
// panel.obj[Map.OVERWORLD.getIndex()][i] = new LanternObj(panel);
|
||||
// panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*18;
|
||||
// panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*20;
|
||||
// i++;
|
||||
//
|
||||
// panel.obj[Map.OVERWORLD.getIndex()][i] = new TentObj(panel);
|
||||
// panel.obj[Map.OVERWORLD.getIndex()][i].worldX = panel.tileSize*19;
|
||||
// panel.obj[Map.OVERWORLD.getIndex()][i].worldY = panel.tileSize*20;
|
||||
// i++;
|
||||
}
|
||||
|
||||
public void setNPC() {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class Sound {
|
||||
load(11, "assets/sounds/cuttree.wav");
|
||||
load(12, "assets/sounds/gameover.wav");
|
||||
load(13, "assets/sounds/stairs.wav");
|
||||
load(14, "assets/sounds/sleep.wav");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
Reference in New Issue
Block a user