-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from MutantPiggieGolem1/menu
yay
- Loading branch information
Showing
100 changed files
with
938 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "java", | ||
"mainClass": "hugone.App", | ||
"targetPath": "${workspaceFolder}/${workspaceFolderBasename}.jar", | ||
"elements": [ | ||
"${compileOutput}", | ||
"${dependencies}" | ||
], | ||
"problemMatcher": [], | ||
"label": "java: exportjar:hugone", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Main-Class: hugoneseven.App | ||
Class-Path: . | ||
Main-Class: hugone.App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Hugone Seven | ||
# Hugone | ||
An undertale-style horror game designed with rhythm battles | ||
Commissioned. | ||
#### Commissioned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package hugone; | ||
|
||
import java.awt.Graphics2D; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ScheduledExecutorService; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import javax.swing.JFrame; | ||
|
||
import hugone.Constants.Feature; | ||
import hugone.Constants.GameState; | ||
import hugone.util.Utils; | ||
|
||
class App { | ||
public static java.util.HashMap<String,Object> shit = new java.util.HashMap<String,Object>(); // stores temporary vars to be relayed to main file | ||
|
||
public static Story story; | ||
public static Player player; | ||
public static GameState gamestate; | ||
|
||
public static final JFrame f = new JFrame("Hugone - Alpha Version"); | ||
private static final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); | ||
|
||
public static void main(String[] args) { | ||
try { | ||
story = new Story("story.json"); | ||
story.init(); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Couldn't initalize story.\nDetais: " + e.toString()); | ||
} | ||
player = story.player; | ||
gamestate = story.currentState(); | ||
|
||
DrawingCanvas dc = new DrawingCanvas(f); | ||
f.setIconImage(Utils.ICONIMG); | ||
f.setFocusable(true); | ||
f.setResizable(false); | ||
f.setUndecorated(false); | ||
f.setExtendedState(JFrame.MAXIMIZED_BOTH); | ||
f.add(dc); | ||
f.addKeyListener(player); | ||
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
|
||
// Game Loop begins | ||
executor.scheduleAtFixedRate(() -> { | ||
try { | ||
Feature cur = story.getCurrent(); | ||
if (cur.update()) | ||
story.next(); // on completion, advance story | ||
cur = story.getCurrent(); | ||
switch (story.currentState()) { | ||
case MENU: | ||
Menu m = (Menu) cur; | ||
m.update(); | ||
break; | ||
case CUTSCENE: | ||
break; | ||
case EXPLORATION: | ||
Area a = (Area) cur; | ||
if(!a.renderingDialogue()) { | ||
player.moveLoop(); | ||
a.checkInteracts(player); | ||
} | ||
break; | ||
case BATTLE: | ||
Battle b = (Battle) cur; | ||
b.beat(); | ||
break; | ||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
System.exit(0); | ||
} | ||
}, 0, (long) (1000 / Constants.TPS), TimeUnit.MILLISECONDS); | ||
|
||
f.setVisible(true); | ||
f.requestFocus(); | ||
dc.startDraw(); | ||
f.setEnabled(true); | ||
} | ||
|
||
public static void render(Graphics2D g) { | ||
story.getCurrent().render(g); | ||
} | ||
|
||
public static void postRender(Graphics2D g) { | ||
g.drawString(String.valueOf(Utils.fps()), 0, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.