Advertisement
Guest User

Untitled

a guest
Nov 28th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 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 static javafx.application.Application.launch;
  8. import javafx.geometry.Insets;
  9. import javafx.geometry.Pos;
  10. import javafx.scene.Scene;
  11. import javafx.scene.control.Button;
  12. import javafx.scene.control.Label;
  13. import javafx.scene.control.TextField;
  14. import javafx.scene.image.Image;
  15. import javafx.scene.image.ImageView;
  16. import javafx.scene.layout.GridPane;
  17. import javafx.scene.layout.VBox;
  18. import javafx.stage.Modality;
  19. import javafx.stage.Stage;
  20.  
  21. public class TheGame extends Application {
  22.  
  23. Stage window;
  24.  
  25. public static void main(String[] args) {
  26. launch(args);
  27. }
  28.  
  29. @Override
  30. public void start(Stage primaryStage) throws Exception {
  31. window = primaryStage;
  32. window.setTitle("GridPanes");
  33.  
  34. //GridPane with 10px padding around edge
  35. GridPane grid = new GridPane();
  36. grid.setPadding(new Insets(10, 10, 10, 10));
  37. grid.setVgap(8);
  38. grid.setHgap(10);
  39.  
  40. //Name Label - constrains use (child, column, row)
  41. Label nameLabel = new Label("Username:");
  42. GridPane.setConstraints(nameLabel, 1, 0);
  43.  
  44. //Name Input
  45. TextField nameInput = new TextField("Jamesus");
  46. GridPane.setConstraints(nameInput, 2, 0);
  47.  
  48. //Password Label
  49. Label passLabel = new Label("Password:");
  50. GridPane.setConstraints(passLabel, 1, 1);
  51.  
  52. //Password Input
  53. TextField passInput = new TextField();
  54. passInput.setPromptText("password");
  55. GridPane.setConstraints(passInput, 2, 1);
  56.  
  57. //Login
  58. Button loginButton = new Button("Log In");
  59. GridPane.setConstraints(loginButton, 1, 2);
  60.  
  61. Image Img = new Image("file:Vampire.png");
  62. ImageView Vampire = new ImageView(Img);
  63. Vampire.setFitWidth(300);
  64. Vampire.setFitHeight(250);
  65. //GridPane.getChildren().add(new ImageView(image));
  66.  
  67. //Add everything to grid
  68. grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton, Vampire);
  69.  
  70. Scene scene = new Scene(grid, 650, 500);
  71. window.setScene(scene);
  72. window.show();
  73. Start();
  74. }
  75.  
  76. protected Object[][][] Start() {
  77. Character Caller = new Character();
  78. Object[][][] Dude = Caller.OurGuy();
  79. Stage Window = new Stage();
  80. Window.initModality(Modality.APPLICATION_MODAL);
  81. Window.setTitle("Character Creation");
  82.  
  83. Label Label = new Label();
  84. Label.setText("Fill out the options with what you want to carry throughout the game");
  85.  
  86. Button YesButton = new Button("Done");
  87.  
  88. TextField NameInput = new TextField("Your Name");
  89. TextField CharInput = new TextField("Character's Name");
  90.  
  91. YesButton.setOnAction(e -> {
  92. Window.close();
  93. });
  94.  
  95. VBox Layout = new VBox(10);
  96. Layout.getChildren().addAll(Label, YesButton, NameInput, CharInput);
  97. Layout.setAlignment(Pos.CENTER);
  98.  
  99. Scene Scene = new Scene(Layout, 300, 250);
  100. Window.setScene(Scene);
  101. Window.showAndWait();
  102.  
  103. return Dude;
  104. }
  105.  
  106. protected void Welcome() {
  107. //very easy
  108. //Vampires S U C C
  109. //Welcome to Vampires S U C C, your goal is to survive long enough to travel
  110. //to the CDC in Georgia to escape the Vampire apocalypse.
  111. //References this method only once per playthrough
  112. JOptionPane.showMessageDialog(null, "Welcome to Vampires S U C C, your goal,"
  113. + " is to survive long enough to travel to the CDC in Georgia to,"
  114. + " escape the Vampire apocalypse. ");
  115. }
  116.  
  117. protected void Story() {
  118. //very easy
  119.  
  120. }
  121.  
  122. protected void Travel() {
  123.  
  124. JFrame frame = new JFrame("AnyThing");
  125.  
  126. //Custom button text
  127. Object[] options = {"Travel",
  128. "Inventory",
  129. "Level Up",};
  130. int n = JOptionPane.showOptionDialog(frame,
  131. "Which Direction would you like to move ",
  132. "My Program",
  133. JOptionPane.YES_NO_CANCEL_OPTION,
  134. JOptionPane.QUESTION_MESSAGE,
  135. null,
  136. options,
  137. options[2]);
  138.  
  139. }
  140.  
  141. protected void Lair1() {
  142. //intermediate
  143.  
  144. }
  145. }
  146.  
  147. class TheFight {
  148.  
  149. //all of these are fairly difficult, but also a little bit copy paste once the first is done.
  150. protected void Encounter1() {
  151.  
  152. }
  153.  
  154. protected void Encounter2() {
  155.  
  156. }
  157.  
  158. protected void Encounter3() {
  159.  
  160. }
  161.  
  162. protected void Encounter4() {
  163.  
  164. }
  165.  
  166. protected void Encounter5() {
  167.  
  168. }
  169.  
  170. protected void Encounter6() {
  171.  
  172. }
  173.  
  174. protected void Encounter7() {
  175.  
  176. }
  177.  
  178. protected void Encounter8() {
  179.  
  180. }
  181.  
  182. protected void Encounter9() {
  183.  
  184. }
  185.  
  186. protected void Encounter10() {
  187. //boss fight
  188. }
  189. }
  190.  
  191. class Character {
  192.  
  193. //literal brain torture
  194. protected Object[][][] OurGuy() {
  195. Object[][][] Dude = {
  196. /*
  197. HP = Health
  198. ATK = Attack
  199. REC = Recovery/Passive health regen
  200. AGI = Speed/Agility
  201. */
  202. {// HP ATK REC AGI
  203. {50.0, 5.0, 3.0, 1.0},},
  204. //inventory, 10 slots
  205. {
  206. //Name(String),Damage(Double),HasEffect(Boolean),Effect(String),Positive(Boolean),Effect
  207. {},
  208. {},
  209. {},
  210. {},
  211. {},
  212. {},
  213. {},
  214. {},
  215. {},
  216. {}
  217. }
  218. };
  219. return Dude;
  220. }
  221.  
  222. }
  223.  
  224. class Vampire implements Required {
  225.  
  226. @Override
  227. public String Name() {
  228. return "Vampire";
  229. }
  230.  
  231. @Override
  232. public double Health() {
  233. Random rn = new Random();
  234. int n = 65 - 50 + 1;
  235. int i = rn.nextInt() % n;
  236. int HP = 50 + i;
  237. return HP;
  238. }
  239.  
  240. @Override
  241. public boolean HasAbility() {
  242. return false;
  243. }
  244.  
  245. @Override
  246. public String Ability() {
  247. return "";
  248.  
  249. }
  250.  
  251. @Override
  252. public boolean ToHero() {
  253. return false;
  254.  
  255. }
  256.  
  257. @Override
  258. public double AbilityEffToHP() {
  259. return 0.0;
  260. }
  261.  
  262. }
  263.  
  264. interface Required {
  265.  
  266. public String Name();
  267.  
  268. public double Health();
  269.  
  270. public boolean HasAbility();
  271.  
  272. public String Ability();
  273.  
  274. public boolean ToHero();
  275. //if true that means it hits the hero, if false it hits both
  276.  
  277. public double AbilityEffToHP();
  278.  
  279. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement