Skip to content

Commit

Permalink
Version V1.0.0 Final release
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroBoy404NotFound committed Jan 10, 2023
1 parent edd8bda commit 67048b2
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 36 deletions.
Binary file modified bin/me/ElectronicsBoy/GameEngine/gui/HUD.class
Binary file not shown.
Binary file modified bin/me/ElectronicsBoy/wavegame/Game.class
Binary file not shown.
34 changes: 34 additions & 0 deletions crashReports/CrashReport_10-0-2023 17-34-28.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Game Crash Report
-----------------

All known info is shown below
-----------------------------
StackTrace:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at me.ElectronicsBoy.GameEngine.gui.HUD.render(HUD.java:57)
at me.ElectronicsBoy.wavegame.Game.renderUI(Game.java:129)
at me.ElectronicsBoy.GameEngine.gui.GUIWindow.render(GUIWindow.java:31)
at me.ElectronicsBoy.GameEngine.Engine.render(Engine.java:139)
at me.ElectronicsBoy.GameEngine.Engine.run(Engine.java:81)
at java.base/java.lang.Thread.run(Thread.java:833)

Caused by:
null

Message:
Index 0 out of bounds for length 0
Current Thread:
Engine Thread

System Details:
OS : Linux
OS Version : 5.15.0-56-generic
OS Architecture : amd64
Current Dir : /home/electronicsboy/ElectroGamingStudios/WaveGame

#@!Game has crashed! Crash Report saved to /home/electronicsboy/ElectroGamingStudios/WaveGame/crashReports/CrashReport_10-0-2023 17-34-28.txt!@#
30 changes: 30 additions & 0 deletions crashReports/CrashReport_5-0-2023 22-16-3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Game Crash Report
-----------------

All known info is shown below
-----------------------------
StackTrace:
java.lang.NullPointerException: Cannot invoke "me.ElectronicsBoy.GameEngine.SpriteSheet.SpriteSheet.grabImage(int, int, int, int)" because "this.spriteSheet" is null
at me.ElectronicsBoy.wavegame.Game.getImg(Game.java:137)
at me.ElectronicsBoy.wavegame.entities.BasicEnemy.<init>(BasicEnemy.java:16)
at me.ElectronicsBoy.wavegame.Game.tickUI(Game.java:67)
at me.ElectronicsBoy.GameEngine.gui.GUIWindow.tick(GUIWindow.java:27)
at me.ElectronicsBoy.GameEngine.Engine.tick(Engine.java:56)
at me.ElectronicsBoy.GameEngine.Engine.run(Engine.java:76)
at java.base/java.lang.Thread.run(Thread.java:833)

Caused by:
null

Message:
Cannot invoke "me.ElectronicsBoy.GameEngine.SpriteSheet.SpriteSheet.grabImage(int, int, int, int)" because "this.spriteSheet" is null
Current Thread:
Engine Thread

System Details:
OS : Linux
OS Version : 5.15.0-56-generic
OS Architecture : amd64
Current Dir : /home/electronicsboy/ElectroGamingStudios/WaveGame

#@!Game has crashed! Crash Report saved to /home/electronicsboy/ElectroGamingStudios/WaveGame/crashReports/CrashReport_5-0-2023 22-16-3.txt!@#
32 changes: 19 additions & 13 deletions engine/me/ElectronicsBoy/GameEngine/gui/HUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;

import me.ElectronicsBoy.GameEngine.Util.Util;

public class HUD {

private HashMap<Integer, String>renderNames = new HashMap<Integer, String>();
private HashMap<Integer, String>renderNamesValue = new HashMap<Integer, String>();
private List<String> renderName = new ArrayList<String>();
private List<String> renderValue = new ArrayList<String>();

private Font font = new Font("arial", 1, 15);

private int indent = 16;
private int lastItemX = 5;
private int nextX = lastItemX + indent;
private int lastValue = 0;

public float health = 100;

Expand Down Expand Up @@ -54,23 +54,29 @@ public void render(Graphics g) {

g.setColor(Color.WHITE);
g.setFont(font);
g.drawString(renderNames.get(0) + ": " + renderNamesValue.get(0), 15, nextX);
indent = 8;
nextX += lastItemX + indent;
for(int i = 1; i < renderNames.size(); i++) {
g.drawString(renderNames.get(i) + ": " + renderNamesValue.get(i), 15, nextX);
if(!renderName.isEmpty()) {
g.drawString(renderName.get(0) + ": " + renderValue.get(0), 15, nextX);
indent = 8;
nextX += lastItemX + indent;
for(int i = 1; i < renderName.size(); i++) {
g.drawString(renderName.get(i) + ": " + renderValue.get(i), 15, nextX);
nextX += lastItemX + indent;
}
}
}

public void addRenderValue(String var, String value) {
renderNames.put(lastValue, var);
renderNamesValue.put(lastValue, value);
lastValue++;
renderName.add(var);
renderValue.add(value);
}

public void updateValue(int valuePoint, String value) {
int actuallPoint = valuePoint-1;
renderNamesValue.put(actuallPoint, value);
renderValue.set(actuallPoint, value);
}

public void removeAll() {
renderName.removeIf((e) -> true);
renderValue.removeIf((e) -> true);
}
}
Binary file modified res/save.bin
Binary file not shown.
26 changes: 24 additions & 2 deletions src/me/ElectronicsBoy/wavegame/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class Game extends GUIWindow implements HUDPostTick {
public Main main;

public boolean useSave = true;
public boolean inited = false;

public Game(Engine engine) {
super("PLAY", engine);
Expand All @@ -53,11 +54,13 @@ public void init() {
@Override
public void tickUI() {
if(gameStart) {
inited = true;
((Main)engine).handler.clearAll();
try {
if(useSave)
if(useSave) {
save.read().forEach((e) -> { ((Main)engine).handler.addObject(e); });
else {
hudReady = true;
}else {
((Main)engine).handler.addObject(new BasicEnemy());
player = new PlayerEntity(((Main)engine));
((Main)engine).handler.addObject(player);
Expand Down Expand Up @@ -139,4 +142,23 @@ public BufferedImage getImg(int i, int j, int k, int l) {

@Override
public void postHUDTick() {}
public void reset() {
levelsTillBoss = 0;
levelsReset = 0;
scoreKeep = 0;
reset = 0;
level = 1;
fullScore = 0;
player = null;
hudReady = false;

afterScoreLevel = 100;
bossFight = false;

boss = null;
hud.health = 100;
hud.removeAll();

// inited = false;
}
}
20 changes: 2 additions & 18 deletions src/me/ElectronicsBoy/wavegame/gui/PauseMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ public void init() {
} catch (Exception e) {
e.printStackTrace();
}
Game.inst.level = 0;
Game.inst.levelsReset = 0;
Game.inst.scoreKeep = 0;
Game.inst.reset = 0;
Game.inst.level = 1;
Game.inst.afterScoreLevel = 100;
hud.health = 100;
hud.updateValue(1, "0");
hud.updateValue(2, "0");
Game.inst.reset();
engine.sys.setState("MENU");
}));
addButton(new Button(190, 260, 230, 64, Color.WHITE, Color.WHITE, ButtonStyle.createStyle(new Font("arial", 1, 30), ButtonStyle.Rect), 260, 300, "Save", Color.WHITE, () -> {
Expand All @@ -43,15 +35,7 @@ public void init() {
}
}));
addButton(new Button(190, 170, 230, 64, Color.WHITE, Color.WHITE, ButtonStyle.createStyle(new Font("arial", 1, 30), ButtonStyle.Rect), 260, 210, "Quit", Color.WHITE, () -> {
Game.inst.level = 0;
Game.inst.levelsReset = 0;
Game.inst.scoreKeep = 0;
Game.inst.reset = 0;
Game.inst.level = 1;
Game.inst.afterScoreLevel = 100;
hud.health = 100;
hud.updateValue(1, "0");
hud.updateValue(2, "0");
Game.inst.reset();
engine.sys.setState("MENU");
}));
addButton(new Button(190, 80, 230, 64, Color.WHITE, Color.WHITE, ButtonStyle.createStyle(new Font("arial", 1, 30), ButtonStyle.Rect), 230, 120, "Continue", Color.WHITE, () -> {
Expand Down
11 changes: 8 additions & 3 deletions src/me/ElectronicsBoy/wavegame/save/Save.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public void save() throws Exception {
writer.writeFloat(main.hud.health);
for(Entity e : main.entitis) {
if(!(e instanceof BossEntity)) {
System.out.println(e.getClass().getName());
writer.writeString(e.getClass().getName());
writer.writeFloat(e.getX());
writer.writeFloat(e.getY());
Expand All @@ -60,6 +59,7 @@ public void save() throws Exception {
}
}
public List<Entity> read() throws Exception {
Game.inst.reset();
List<Entity> entities = new ArrayList<Entity>();
if(binfile.exists()) {
BinaryReader reader = new BinaryReader(binfile);
Expand All @@ -83,12 +83,17 @@ public List<Entity> read() throws Exception {
Game.inst.fullScore = reader.readInt();
Game.inst.afterScoreLevel = reader.readInt();
main.hud.health = reader.readFloat();
main.hud.updateValue(1, Integer.toString(Game.inst.level));
if(!Game.inst.hudReady){
main.hud.addRenderValue("Level", Integer.toString(Game.inst.level));
main.hud.addRenderValue("Score", Integer.toString(Game.inst.scoreKeep));
}else {
main.hud.updateValue(1, Integer.toString(Game.inst.level));
main.hud.updateValue(2, Integer.toString(Game.inst.scoreKeep));
}

while(reader.available()) {
Entity e;
String s = reader.readString();
System.out.println(s);
switch(s) {
case "me.ElectronicsBoy.wavegame.entities.PlayerEntity":
e = new PlayerEntity(main);
Expand Down

0 comments on commit 67048b2

Please sign in to comment.