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 {
- Stage window;
- Font chillerFont = new Font("Chiller", 22);
- public static void main(String[] args) {
- launch(args);
- }
- @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);
- nameLabel.setFont(chillerFont);
- //Name Input
- TextField nameInput = new TextField("Jamesus");
- GridPane.setConstraints(nameInput, 2, 0);
- nameInput.setFont(chillerFont);
- //Password Label
- Label passLabel = new Label("Password:");
- GridPane.setConstraints(passLabel, 1, 1);
- passLabel.setFont(chillerFont);
- //Password Input
- TextField passInput = new TextField();
- passInput.setPromptText("password");
- GridPane.setConstraints(passInput, 2, 1);
- passInput.setFont(chillerFont);
- //Login
- Button loginButton = new Button("Log In");
- GridPane.setConstraints(loginButton, 1, 2);
- loginButton.setFont(chillerFont);
- 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();
- Opening();
- }
- protected Object[][][] Opening() {
- 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);
- Label.setFont(chillerFont);
- NameInput.setFont(chillerFont);
- CharInput.setFont(chillerFont);
- 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 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);
- introText.setTextAlignment(TextAlignment.CENTER);
- introText.setFont(chillerFont);
- 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() {
- Stage storyStage = new Stage();
- storyStage.setTitle("Story");
- Label storyText = new Label("Vampires are everywhere and you are alone. You may be\n"
- + "immune to the virus that caused the vampires to roam the \n"
- + "Earth, but you are not indestructible. Your goal is to\n"
- + "survive long enough to reach the Centers for Disease\n"
- + " Control in Georgia. Buy, sell, and find items to increase\n"
- + " your chances of survival. Encounter bosses and fight your\n"
- + " way through lairs to continue on the long road to safety. \n");
- storyText.setFont(chillerFont);
- storyText.setTextAlignment(TextAlignment.CENTER);
- Label goodLuck = new Label("Good luck traveler...");
- goodLuck.setFont(chillerFont);
- VBox storyVBox = new VBox();
- storyVBox.setAlignment(Pos.CENTER);
- storyVBox.getChildren().add(storyText);
- storyVBox.getChildren().add(goodLuck);
- Scene storyScene = new Scene(storyVBox, 650, 500);
- storyStage.setScene(storyScene);
- storyStage.show();
- }
- protected void Travel() {
- }
- protected void Lair1() {
- //intermediate
- }
- }
- class TheFight {
- //all of these are fairly difficult, but also a little bit copy paste once the first is done.
- 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;
- }
- }
- class Vampire implements Required {
- @Override
- public String Name() {
- return "Vampire";
- }
- @Override
- public double Health() {
- Random rn = new Random();
- int n = 65 - 50 + 1;
- int i = rn.nextInt() % n;
- int HP = 50 + i;
- return HP;
- }
- @Override
- public boolean HasAbility() {
- return false;
- }
- @Override
- public String Ability() {
- return "";
- }
- @Override
- public boolean ToHero() {
- return false;
- }
- @Override
- public double AbilityEffToHP() {
- return 0.0;
- }
- }
- 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