Advertisement
Guest User

New Code

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