Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.11 KB | None | 0 0
  1. package thegame;
  2.  
  3. import java.util.*;
  4. import java.math.*;
  5. import javax.swing.*;
  6. import javafx.application.Application;
  7. import javafx.geometry.Insets;
  8. import javafx.geometry.Pos;
  9. import javafx.scene.Scene;
  10. import javafx.scene.control.Button;
  11. import javafx.scene.control.Label;
  12. import javafx.scene.control.TextField;
  13. import javafx.scene.image.Image;
  14. import javafx.scene.image.ImageView;
  15. import javafx.scene.layout.GridPane;
  16. import javafx.scene.layout.VBox;
  17. import javafx.scene.text.Font;
  18. import javafx.scene.text.TextAlignment;
  19. import javafx.stage.Modality;
  20. import javafx.stage.Stage;
  21.  
  22. public class TheGame extends Application {
  23.  
  24.     Stage window;
  25.     Font chillerFont = new Font("Chiller", 22);
  26.  
  27.     public static void main(String[] args) {
  28.         launch(args);
  29.     }
  30.  
  31.     @Override
  32.     public void start(Stage primaryStage) throws Exception {
  33.        
  34.         window = primaryStage;
  35.         window.setTitle("GridPanes");
  36.  
  37.         //GridPane with 10px padding around edge
  38.         GridPane grid = new GridPane();
  39.         grid.setPadding(new Insets(10, 10, 10, 10));
  40.         grid.setVgap(8);
  41.         grid.setHgap(10);
  42.  
  43.         //Name Label - constrains use (child, column, row)
  44.         Label nameLabel = new Label("Username:");
  45.         GridPane.setConstraints(nameLabel, 1, 0);
  46.         nameLabel.setFont(chillerFont);
  47.  
  48.         //Name Input
  49.         TextField nameInput = new TextField("Jamesus");
  50.         GridPane.setConstraints(nameInput, 2, 0);
  51.         nameInput.setFont(chillerFont);
  52.  
  53.         //Password Label
  54.         Label passLabel = new Label("Password:");
  55.         GridPane.setConstraints(passLabel, 1, 1);
  56.         passLabel.setFont(chillerFont);
  57.  
  58.         //Password Input
  59.         TextField passInput = new TextField();
  60.         passInput.setPromptText("password");
  61.         GridPane.setConstraints(passInput, 2, 1);
  62.         passInput.setFont(chillerFont);
  63.  
  64.         //Login
  65.         Button loginButton = new Button("Log In");
  66.         GridPane.setConstraints(loginButton, 1, 2);
  67.         loginButton.setFont(chillerFont);
  68.  
  69.         Image Img = new Image("file:Vampire.png");
  70.         ImageView Vampire = new ImageView(Img);
  71.         Vampire.setFitWidth(300);
  72.         Vampire.setFitHeight(250);
  73.         //GridPane.getChildren().add(new ImageView(image));
  74.  
  75.         //Add everything to grid
  76.         grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton, Vampire);
  77.  
  78.         Scene scene = new Scene(grid, 650, 500);
  79.         window.setScene(scene);
  80.         window.show();
  81.         Opening();
  82.     }
  83.  
  84.     protected Object[][][] Opening() {
  85.         Character Caller = new Character();
  86.         Object[][][] Dude = Caller.OurGuy();
  87.         Stage Window = new Stage();
  88.         Window.initModality(Modality.APPLICATION_MODAL);
  89.         Window.setTitle("Character Creation");
  90.  
  91.         Label Label = new Label();
  92.         Label.setText("Fill out the options with what you want to carry throughout the game");
  93.  
  94.         Button YesButton = new Button("Done");
  95.  
  96.         TextField NameInput = new TextField("Your Name");
  97.         TextField CharInput = new TextField("Character's Name");
  98.  
  99.         YesButton.setOnAction(e -> {
  100.             Window.close();
  101.         });
  102.  
  103.         VBox Layout = new VBox(10);
  104.         Label.setFont(chillerFont);
  105.         NameInput.setFont(chillerFont);
  106.         CharInput.setFont(chillerFont);
  107.         Layout.getChildren().addAll(Label, YesButton, NameInput, CharInput);
  108.         Layout.setAlignment(Pos.CENTER);
  109.  
  110.         Scene Scene = new Scene(Layout, 300, 250);
  111.         Window.setScene(Scene);
  112.         Window.showAndWait();
  113.  
  114.         return Dude;
  115.     }
  116.  
  117.     protected void Welcome() {
  118.         //very easy
  119.         //Vampires S U C C
  120.         //Welcome to Vampires S U C C, your goal is to survive long enough to travel
  121.         //to the CDC in Georgia to escape the Vampire apocalypse.
  122.         //References this method only once per playthrough
  123.        
  124.         Stage welcomeStage = new Stage();
  125.         welcomeStage.setTitle("Welcome to Vampires S U C C");
  126.         Label introText = new Label("Welcome to Vampires S U C C, your goal,"
  127.                 + " is to survive long\nenough to travel to the CDC in Georgia to,"
  128.                 + " escape the\nVampire apocalypse. ");
  129.         introText.setPrefWidth(300);
  130.         introText.setTextAlignment(TextAlignment.CENTER);
  131.         introText.setFont(chillerFont);
  132.        
  133.         VBox welcomeVBox = new VBox();
  134.         welcomeVBox.setAlignment(Pos.CENTER);
  135.         welcomeVBox.getChildren().add(introText);
  136.        
  137.         Scene welcomeScene = new Scene(welcomeVBox, 650, 500);
  138.         welcomeStage.setScene(welcomeScene);
  139.         welcomeStage.show();
  140.        
  141.     }
  142.  
  143.     protected void Story() {
  144.  
  145.         Stage storyStage = new Stage();
  146.         storyStage.setTitle("Story");
  147.        
  148.         Label storyText = new Label("Vampires are everywhere and you are alone. You may be\n"
  149.                  + "immune to the virus that caused the vampires to roam the \n"
  150.                  + "Earth, but you are not indestructible. Your goal is to\n"
  151.                  + "survive long enough to reach the Centers for Disease\n"
  152.                  + " Control in Georgia. Buy, sell, and find items to increase\n"
  153.                  + " your chances of survival. Encounter bosses and fight your\n"
  154.                  + " way through lairs to continue on the long road to safety. \n");
  155.         storyText.setFont(chillerFont);
  156.         storyText.setTextAlignment(TextAlignment.CENTER);
  157.        
  158.         Label goodLuck = new Label("Good luck traveler...");
  159.         goodLuck.setFont(chillerFont);
  160.        
  161.         VBox storyVBox = new VBox();
  162.         storyVBox.setAlignment(Pos.CENTER);
  163.         storyVBox.getChildren().add(storyText);
  164.         storyVBox.getChildren().add(goodLuck);
  165.        
  166.         Scene storyScene = new Scene(storyVBox, 650, 500);
  167.         storyStage.setScene(storyScene);
  168.         storyStage.show();
  169.        
  170.     }
  171.  
  172.     protected void Travel() {
  173.        
  174.     }
  175.  
  176.     protected void Lair1() {
  177.         //intermediate
  178.  
  179.     }
  180. }
  181.  
  182. class TheFight {
  183.  
  184.     //all of these are fairly difficult, but also a little bit copy paste once the first is done.
  185.     protected void Encounter1() {
  186.  
  187.     }
  188.  
  189.     protected void Encounter2() {
  190.  
  191.     }
  192.  
  193.     protected void Encounter3() {
  194.  
  195.     }
  196.  
  197.     protected void Encounter4() {
  198.  
  199.     }
  200.  
  201.     protected void Encounter5() {
  202.  
  203.     }
  204.  
  205.     protected void Encounter6() {
  206.  
  207.     }
  208.  
  209.     protected void Encounter7() {
  210.  
  211.     }
  212.  
  213.     protected void Encounter8() {
  214.  
  215.     }
  216.  
  217.     protected void Encounter9() {
  218.  
  219.     }
  220.  
  221.     protected void Encounter10() {
  222.         //boss fight
  223.     }
  224. }
  225.  
  226. class Character {
  227.  
  228.     //literal brain torture
  229.     protected Object[][][] OurGuy() {
  230.         Object[][][] Dude = {
  231.             /*
  232.             NM = Name
  233.             LVL = Level
  234.             VIT = Vitality/HP
  235.             ATK = Attack
  236.             REC = Recovery/Passive health regen
  237.             AGI = Speed/Agility            
  238.             STR = Strength
  239.             SPD = Speed
  240.             EFF = Effect
  241.             DEF = Defense
  242.              */
  243.             {//  NM LVL  VIT  STR  REC  SPD  RES  DEF
  244.                
  245.                
  246.                 {"", 0, 50.0, 5.0, 3.0, 1.0,  0,  0.0},},
  247.             //inventory, 10 slots
  248.             { //          NAME          DMG    SPD    EFT
  249.                 {"S U C C Broadsword" ,   9,    70},  //8 hits
  250.                 {"Pointy Stick"       ,  11,    65},  //6 hits
  251.                 {"Stabby Sword"       ,  20,    50},  //4 hits
  252.                 {"Bowstaff"           ,  15,    55},  //5 hits
  253.                 {"Sai"                ,  33,    26},  //2 hits
  254.                 {"Slim Broadsword"    ,  18,    38},  //4 hits
  255.                 {"Nunchucks"          ,  12,    60},  //6 hits
  256.                 {"Battle Axe"         ,  25,    45},
  257.                 {"Baseball Bat"       ,   7,    90},
  258.                 {"Katana"             ,  20,    65},
  259.                 {"Frying Pan"         ,   8,    70},
  260.                 {"Homemade Wristblade",  15,    70},
  261.                 {"Stake Launcher"     ,  37,    50},
  262.                 {"Hatchet"            ,  20,    65},
  263.                 {},
  264.                 {}
  265.             }
  266.         };
  267.         return Dude;
  268.     }
  269. }
  270.  
  271. class Vampire implements Required {
  272.  
  273.     @Override
  274.     public String Name() {
  275.         return "Vampire";
  276.     }
  277.  
  278.     @Override
  279.     public double Health() {
  280.         Random rn = new Random();
  281.         int n = 65 - 50 + 1;
  282.         int i = rn.nextInt() % n;
  283.         int HP = 50 + i;
  284.         return HP;
  285.     }
  286.  
  287.     @Override
  288.     public boolean HasAbility() {
  289.         return false;
  290.     }
  291.  
  292.     @Override
  293.     public String Ability() {
  294.         return "";
  295.  
  296.     }
  297.  
  298.     @Override
  299.     public boolean ToHero() {
  300.         return false;
  301.  
  302.     }
  303.  
  304.     @Override
  305.     public double AbilityEffToHP() {
  306.         return 0.0;
  307.     }
  308.  
  309. }
  310.  
  311. interface Required {
  312.  
  313.     public String Name();
  314.  
  315.     public double Health();
  316.  
  317.     public boolean HasAbility();
  318.  
  319.     public String Ability();
  320.  
  321.     public boolean ToHero();
  322. //if true that means it hits the hero, if false it hits both
  323.  
  324.     public double AbilityEffToHP();
  325.  
  326. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement