Skip to content

Commit 005fca1

Browse files
committed
added base skeleton of stat page
1 parent ef3b159 commit 005fca1

File tree

7 files changed

+252
-3
lines changed

7 files changed

+252
-3
lines changed

src/main/java/com/wesleycodingteam/App.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private static Parent loadFXML(String fxml) throws IOException {
3333
}
3434

3535
public static void main(String[] args) {
36+
MainCharacter.makeStats("Jaeyoung", 10, 10,10);
3637
launch();
3738
}
3839

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
package com.wesleycodingteam;
22

33
import java.io.IOException;
4+
5+
import javafx.event.ActionEvent;
46
import javafx.fxml.FXML;
7+
import javafx.fxml.FXMLLoader;
8+
import javafx.scene.Parent;
9+
import javafx.scene.Scene;
510
import javafx.scene.control.Label;
11+
import javafx.stage.Stage;
612

713
public class Intro {
814
@FXML
915
private Label dialogue;
10-
void setMessage(String str){
11-
dialogue.setText(str);
16+
17+
@FXML
18+
void callStatPage(ActionEvent event) {
19+
try {
20+
Parent root = FXMLLoader.load(getClass().getResource("stat.fxml"));
21+
Stage stage = new Stage();
22+
stage.setTitle("Stats");
23+
stage.setScene(new Scene(root,600,500));
24+
stage.show();
25+
} catch (IOException e) {
26+
System.out.println("cant open");
27+
}
28+
1229
}
1330
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.wesleycodingteam;
2+
3+
public class MainCharacter {
4+
static String name; //MainCharacter name
5+
static String classType = "None"; //MainCharacter class
6+
static int lv = 0; //level
7+
static int str = 10; //strength
8+
static int wis = 10; //wisdom
9+
static int agi =10 ; //agility
10+
static int hpMax = 100; //maximum HP
11+
static int hpNow = 100; //current HP
12+
static int mpMax = 100; //maximum MP
13+
static int mpNow = 100; //current MP
14+
static int coin = 0; //money
15+
static int expRequired = 10;
16+
static int currentExp = 0;
17+
static int extraStat = 0;
18+
static int currentPart = 0; //current part in the story
19+
static String occupation = "villager";
20+
static String currentState = "Idle"; //tells what the character is doing idle, fighting, shoping etc.
21+
static double normalDamageMultiplier = 1.0;
22+
static String currentLocation = "Your House";
23+
static String currentField = "Town";
24+
//declaring field
25+
public static void makeStats(String nameChoice, int strChoice, int wisChoice, int agiChoice){
26+
name = nameChoice;
27+
str = strChoice;
28+
wis = wisChoice;
29+
agi = agiChoice;
30+
}
31+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.wesleycodingteam;
2+
3+
import javafx.fxml.FXML;
4+
import javafx.scene.control.Label;
5+
import javafx.scene.control.ProgressBar;
6+
7+
import java.net.URL;
8+
import java.util.ResourceBundle;
9+
10+
public class Stat {
11+
//TODO: connect maincharacter.java with this class so that all updates properly
12+
@FXML
13+
private Label Name;
14+
15+
@FXML
16+
private Label Lv;
17+
18+
@FXML
19+
private Label Class;
20+
21+
@FXML
22+
private Label Agi;
23+
24+
@FXML
25+
private Label Wis;
26+
27+
@FXML
28+
private Label Str;
29+
30+
@FXML
31+
private Label coin;
32+
33+
@FXML
34+
private ProgressBar HPbar;
35+
36+
@FXML
37+
private ProgressBar MPbar;
38+
@FXML
39+
public void initialize() {
40+
updateProgressBar();
41+
Name.setText(MainCharacter.name);
42+
}
43+
@FXML
44+
private void updateProgressBar(){
45+
HPbar.setProgress(MainCharacter.hpNow/(double)MainCharacter.hpMax);
46+
MPbar.setProgress(MainCharacter.mpNow/(double)MainCharacter.mpMax);
47+
}
48+
49+
50+
}

src/main/resources/com/wesleycodingteam/intro.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</AnchorPane>
2727
<HBox prefHeight="100.0" prefWidth="200.0">
2828
<children>
29-
<Button mnemonicParsing="false" text="Button">
29+
<Button mnemonicParsing="false" onAction="#callStatPage" text="Stats">
3030
<HBox.margin>
3131
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
3232
</HBox.margin>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.geometry.Insets?>
4+
<?import javafx.scene.control.Button?>
5+
<?import javafx.scene.control.ComboBox?>
6+
<?import javafx.scene.control.Label?>
7+
<?import javafx.scene.control.ProgressBar?>
8+
<?import javafx.scene.layout.BorderPane?>
9+
<?import javafx.scene.layout.ColumnConstraints?>
10+
<?import javafx.scene.layout.GridPane?>
11+
<?import javafx.scene.layout.HBox?>
12+
<?import javafx.scene.layout.RowConstraints?>
13+
14+
<BorderPane prefHeight="600.0" prefWidth="462.0" styleClass="background" stylesheets="@styles.css" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.wesleycodingteam.Stat">
15+
<top>
16+
<Label alignment="CENTER" maxWidth="-Infinity" prefHeight="41.0" prefWidth="369.0" styleClass="smalltitle" text="STAT" BorderPane.alignment="CENTER">
17+
<BorderPane.margin>
18+
<Insets top="20.0" />
19+
</BorderPane.margin></Label>
20+
</top>
21+
<center>
22+
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="388.0" prefWidth="643.0" BorderPane.alignment="CENTER">
23+
<columnConstraints>
24+
<ColumnConstraints hgrow="NEVER" minWidth="10.0" percentWidth="30.0" prefWidth="100.0" />
25+
<ColumnConstraints halignment="CENTER" hgrow="NEVER" minWidth="10.0" percentWidth="20.0" />
26+
<ColumnConstraints hgrow="NEVER" percentWidth="50.0" />
27+
</columnConstraints>
28+
<rowConstraints>
29+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
30+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
31+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
32+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
33+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
34+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
35+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
36+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
37+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
38+
</rowConstraints>
39+
<children>
40+
<Label styleClass="normalText" stylesheets="@styles.css" text="Strength" GridPane.rowIndex="3" />
41+
<Label fx:id="Name" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" />
42+
<Label fx:id="Lv" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="2" />
43+
<Label styleClass="normalText" stylesheets="@styles.css" text="Level" GridPane.rowIndex="2" />
44+
<Label fx:id="Class" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1" />
45+
<Label styleClass="normalText" stylesheets="@styles.css" text="Class" GridPane.rowIndex="1" />
46+
<Label styleClass="normalText" stylesheets="@styles.css" text="MP" GridPane.rowIndex="7" />
47+
<Label styleClass="normalText" stylesheets="@styles.css" text="HP" GridPane.rowIndex="6" />
48+
<Label fx:id="Agi" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="5" />
49+
<Label fx:id="Wis" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="4" />
50+
<Label fx:id="Str" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" />
51+
<Label styleClass="normalText" stylesheets="@styles.css" text="Agility" GridPane.rowIndex="5" />
52+
<Label styleClass="normalText" stylesheets="@styles.css" text="Wisdom" GridPane.rowIndex="4" />
53+
<Label styleClass="normalText" stylesheets="@styles.css" text="Coin" GridPane.rowIndex="8" />
54+
<Label styleClass="normalText" stylesheets="@styles.css" text="Name" />
55+
<Label fx:id="coin" styleClass="normalText" stylesheets="@styles.css" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="8" />
56+
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="10.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
57+
<children>
58+
<ComboBox prefWidth="150.0" />
59+
<Button mnemonicParsing="false" prefHeight="16.0" prefWidth="30.0" styleClass="smallbutton" text="OK" />
60+
</children>
61+
<GridPane.margin>
62+
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
63+
</GridPane.margin>
64+
</HBox>
65+
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="10.0" GridPane.columnIndex="2" GridPane.rowIndex="4">
66+
<children>
67+
<ComboBox prefWidth="150.0" />
68+
<Button mnemonicParsing="false" prefHeight="16.0" prefWidth="30.0" styleClass="smallbutton" text="OK" />
69+
</children>
70+
<GridPane.margin>
71+
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
72+
</GridPane.margin>
73+
</HBox>
74+
<HBox alignment="CENTER_LEFT" prefHeight="21.0" prefWidth="369.0" spacing="10.0" GridPane.columnIndex="2" GridPane.rowIndex="5">
75+
<children>
76+
<ComboBox prefWidth="150.0" />
77+
<Button mnemonicParsing="false" prefHeight="16.0" prefWidth="28.0" styleClass="smallbutton" text="OK" />
78+
</children>
79+
<GridPane.margin>
80+
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
81+
</GridPane.margin>
82+
</HBox>
83+
<ProgressBar fx:id="HPbar" progress="0.18" styleClass="hpprogress" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="6" GridPane.valignment="CENTER" />
84+
<ProgressBar fx:id="MPbar" progress="1.0" styleClass="mpprogress" GridPane.columnIndex="1" GridPane.rowIndex="7" />
85+
</children>
86+
<BorderPane.margin>
87+
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
88+
</BorderPane.margin>
89+
</GridPane>
90+
</center>
91+
</BorderPane>

src/main/resources/com/wesleycodingteam/styles.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
-fx-text-fill: white;
2020
-fx-font-size: 50px;
2121
}
22+
.smalltitle{
23+
-fx-text-fill: white;
24+
-fx-font-size: 40px;
25+
}
2226
.names{
2327
-fx-text-fill: white;
2428
-fx-font-size: 20px;
@@ -45,4 +49,59 @@
4549
.statbutton{
4650
-fx-background-color: white;
4751
-fx-text-fill: white;
52+
}
53+
.normalText{
54+
-fx-text-fill: white;
55+
-fx-font-size: 15px;
56+
-fx-padding: 3px 3px;
57+
}
58+
.smallbutton{
59+
-fx-background-color: black;
60+
-fx-border-width: 1px;
61+
-fx-border-color: white;
62+
-fx-text-fill: white;
63+
-fx-padding: 1px 2px;
64+
-fx-text-alignment: center;
65+
-fx-border-radius: 3px;
66+
-fx-font-size: 10px;
67+
}
68+
.hpbartext{
69+
-fx-text-fill: black;
70+
-fx-font-size: 12px;
71+
-fx-fit-to-height: true;
72+
73+
}
74+
.hpprogress {
75+
-fx-accent: red;
76+
-fx-max-height: 15px;
77+
-fx-max-width: 120px;
78+
}
79+
.hpprogress .track{
80+
-fx-text-box-border: white;
81+
-fx-border-radius: 5px;
82+
-fx-control-inner-background: white;
83+
-fx-background-insets: 0px;
84+
-fx-background-radius: 10;
85+
}
86+
.hpprogress .bar {
87+
-fx-padding: 10px;
88+
-fx-background-radius: 10;
89+
-fx-background-insets: 2px;
90+
}
91+
.mpprogress {
92+
-fx-accent: #439de3;
93+
-fx-max-height: 15px;
94+
-fx-max-width: 120px;
95+
}
96+
.mpprogress .track{
97+
-fx-text-box-border: white;
98+
-fx-border-radius: 5px;
99+
-fx-control-inner-background: white;
100+
-fx-background-insets: 0px;
101+
-fx-background-radius: 10;
102+
}
103+
.mpprogress .bar {
104+
-fx-padding: 10px;
105+
-fx-background-radius: 10;
106+
-fx-background-insets: 2px;
48107
}

0 commit comments

Comments
 (0)