Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package thegame;
- import java.util.*;
- import java.math.*;
- import javax.swing.*;
- import javafx.application.Application;
- import javafx.geometry.Insets;
- import javafx.geometry.Pos;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.TextField;
- import javafx.scene.image.Image;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.GridPane;
- import javafx.scene.layout.VBox;
- import javafx.scene.text.Font;
- import javafx.scene.text.TextAlignment;
- import javafx.stage.Modality;
- import javafx.stage.Stage;
- public class TheGame extends Application {
- Font chillerFont = new Font("Chiller", 22);
- Stage window;
- public static void main(String[] args) {
- launch(args);
- TheGame bob = new TheGame();
- bob.StartUp();
- }
- @Override
- public void start(Stage primaryStage) throws Exception {
- window = primaryStage;
- window.setTitle("GridPanes");
- //GridPane with 10px padding around edge
- GridPane grid = new GridPane();
- grid.setPadding(new Insets(10, 10, 10, 10));
- grid.setVgap(8);
- grid.setHgap(10);
- //Name Label - constrains use (child, column, row)
- Label nameLabel = new Label("Username:");
- GridPane.setConstraints(nameLabel, 1, 0);
- //Name Input
- TextField nameInput = new TextField("Jamesus");
- GridPane.setConstraints(nameInput, 2, 0);
- //Password Label
- Label passLabel = new Label("Password:");
- GridPane.setConstraints(passLabel, 1, 1);
- //Password Input
- TextField passInput = new TextField();
- passInput.setPromptText("password");
- GridPane.setConstraints(passInput, 2, 1);
- //Login
- Button loginButton = new Button("Log In");
- GridPane.setConstraints(loginButton, 1, 2);
- Image Img = new Image("file:Vampire.png");
- ImageView Vampire = new ImageView(Img);
- Vampire.setFitWidth(300);
- Vampire.setFitHeight(250);
- //GridPane.getChildren().add(new ImageView(image));
- //Add everything to grid
- grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton, Vampire);
- Scene scene = new Scene(grid, 650, 500);
- window.setScene(scene);
- window.show();
- Start();
- }
- protected Object[][][] Start() {
- Character Caller = new Character();
- Object[][][] Dude = Caller.OurGuy();
- Stage Window = new Stage();
- Window.initModality(Modality.APPLICATION_MODAL);
- Window.setTitle("Character Creation");
- Label Label = new Label();
- Label.setText("Fill out the options with what you want to carry throughout the game");
- Button YesButton = new Button("Done");
- TextField NameInput = new TextField("Your Name");
- TextField CharInput = new TextField("Character's Name");
- YesButton.setOnAction(e -> {
- Window.close();
- });
- VBox Layout = new VBox(10);
- Layout.getChildren().addAll(Label, YesButton, NameInput, CharInput);
- Layout.setAlignment(Pos.CENTER);
- Scene Scene = new Scene(Layout, 300, 250);
- Window.setScene(Scene);
- Window.showAndWait();
- return Dude;
- }
- protected void StartUp() {
- //very easy
- TheGame bob = new TheGame();
- for(int a = 0 ; a < 2 ; a++)
- {
- bob.Welcome();
- bob.CharCreation();
- bob.Travel();
- }
- }
- protected void CharCreation() {
- //very easy
- String Name = JOptionPane.showInputDialog("What is your name?");
- }
- protected void Welcome() {
- //very easy
- //Vampires S U C C
- //Welcome to Vampires S U C C, your goal is to survive long enough to travel
- //to the CDC in Georgia to escape the Vampire apocalypse.
- //References this method only once per playthrough
- Stage welcomeStage = new Stage();
- welcomeStage.setTitle("Welcome to Vampires S U C C");
- Label introText = new Label("Welcome to Vampires S U C C, your goal,"
- + " is to survive long\nenough to travel to the CDC in Georgia to,"
- + " escape the\nVampire apocalypse. ");
- introText.setPrefWidth(300);
- VBox welcomeVBox = new VBox();
- welcomeVBox.setAlignment(Pos.CENTER);
- welcomeVBox.getChildren().add(introText);
- Scene welcomeScene = new Scene(welcomeVBox, 650, 500);
- welcomeStage.setScene(welcomeScene);
- welcomeStage.show();
- }
- protected void Story() {
- //very easy
- JOptionPane.showMessageDialog(null,"Vampires are everywhere and you are alone. You may been immune to the virus that caused them to \n"+
- "roam the Earth but you are not indestructable. Surviving long enough to reach the CDC in Georgia. Buy, sell, and find \n"+
- "items to increase your chances of survival. Encounter bosses and fight your way through lairs to continue on the long road to safety. \n"+
- "Good luck traveler...");
- }
- protected void LevelUp(Object Dude[][][]) {
- Stage lvlupStage = new Stage();
- lvlupStage.setTitle("Vampires S U C C");
- Button Vitality = new Button("Vitality");
- Button Strength = new Button("Strength");
- Button Recovery = new Button("Recovery");
- Button Speed = new Button("Speed");
- Button Resistance = new Button("Resistance");
- Button Defense = new Button("Defense");
- //Adds 1 point to the level attribute in the dude array
- Dude[0][0][1] = + 1;
- JFrame frame = new JFrame("Vampires S U C C");
- Object[] options = {"Vitality", "Strength", "Recovery", "Speed", "Resistance", "Defense"};
- int n = JOptionPane.showOptionDialog(frame,
- "Choose the attribute to level up!",
- "Vampires S U C C",
- JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- options,
- options[5]);
- //Adds one point to the selected attribute in the dude array. Adds 2 to
- //compensate for array positioning
- Dude[0][0][n + 2] = + 1;
- }
- protected void Travel(){
- TheGame bob = new TheGame();
- JFrame frame = new JFrame("Vampires S U C C");
- Object[] options = {"Travel", "Story"};
- int n = JOptionPane.showOptionDialog(frame,
- "Which Direction would you like to move ",
- "Vampires S U C C",
- JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- options,
- options[1]);
- if(n == 0)
- {
- }
- else
- {
- if(n == 1)
- {
- bob.Story();
- }
- }
- }
- protected void Lair1() {
- //intermediate
- int n = JOptionPane.showConfirmDialog(null, "Would you like to enter the lair?", "", JOptionPane.YES_NO_OPTION);
- if(true)
- {
- JOptionPane.showMessageDialog(null, "Interesting choice traveler...");
- }
- else
- {
- JOptionPane.showMessageDialog(null, "Interesting choice traveler...");
- }
- }
- }
- class TheFight {
- //all of these are fairly difficult, but also a little bit copy paste once the first is done.
- //add vampire kill to value to determine levelup ex. 5 kills = level 2 10 kills = level 3
- //single encounter for multiple random references?
- protected void Encounter1() {
- }
- protected void Encounter2() {
- }
- protected void Encounter3() {
- }
- protected void Encounter4() {
- }
- protected void Encounter5() {
- }
- protected void Encounter6() {
- }
- protected void Encounter7() {
- }
- protected void Encounter8() {
- }
- protected void Encounter9() {
- }
- protected void Encounter10() {
- //boss fight
- }
- }
- class Character {
- //literal brain torture
- protected Object[][][] OurGuy() {
- Object[][][] Dude = {
- /*
- NM = Name
- LVL = Level
- VIT = Vitality/HP
- ATK = Attack
- REC = Recovery/Passive health regen
- AGI = Speed/Agility
- STR = Strength
- SPD = Speed
- EFF = Effect
- DEF = Defense
- */
- {// NM LVL VIT STR REC SPD RES DEF
- {"", 0, 50.0, 5.0, 3.0, 1.0, 0, 0.0},},
- //inventory, 10 slots
- { // NAME DMG SPD EFT
- {"S U C C Broadsword" , 9, 70}, //8 hits
- {"Pointy Stick" , 11, 65}, //6 hits
- {"Stabby Sword" , 20, 50}, //4 hits
- {"Bowstaff" , 15, 55}, //5 hits
- {"Sai" , 33, 26}, //2 hits
- {"Slim Broadsword" , 18, 38}, //4 hits
- {"Nunchucks" , 12, 60}, //6 hits
- {"Battle Axe" , 25, 45},
- {"Baseball Bat" , 7, 90},
- {"Katana" , 20, 65},
- {"Frying Pan" , 8, 70},
- {"Homemade Wristblade", 15, 70},
- {"Stake Launcher" , 37, 50},
- {"Hatchet" , 20, 65},
- {},
- {}
- }
- };
- return Dude;
- }
- }
- interface Required{
- public String Name();
- public double Health();
- public boolean HasAbility();
- public String Ability();
- public boolean ToHero();
- //if true that means it hits the hero, if false it hits both
- public double AbilityEffToHP();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement