Commit 9b018cee authored by charley.punshon's avatar charley.punshon

Upload project

parent 99f19a8e
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="JavaFX11"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-14.0.2">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX11"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>chacobGame</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=14
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=14
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=14
File added
package application;
import java.io.FileNotFoundException;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws FileNotFoundException {
Button[] buttons = new Button[30];
for(int i = 0; i < buttons.length; i++) {
buttons[i] = new Button();
}
primaryStage.setTitle("The Chacob Game!");
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("couple.jpg")));
ImageView title = new ImageView(new Image(getClass().getResourceAsStream("Chacob.gif")));
title.setX(250);
title.setY(100);
ImageView couple = new ImageView(new Image(getClass().getResourceAsStream("couple.png")));
couple.setX(375);
couple.setY(275);
ImageView background = new ImageView(new Image(getClass().getResourceAsStream("background.jpg")));
Button playGame = new Button();
playGame.setText("Play Game!");
playGame.setLayoutX(400);
playGame.setLayoutY(550);
playGame.setMinHeight(50);
playGame.setMinWidth(150);
playGame.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
ImageView title = new ImageView(new Image(getClass().getResourceAsStream("Q1.png")));
title.setX(250);
title.setY(100);
ImageView q1q = new ImageView(new Image(getClass().getResourceAsStream("q1q.png")));
q1q.setX(175);
q1q.setY(250);
ImageView background = new ImageView(new Image(getClass().getResourceAsStream("background.jpg")));
createAnswerSet(buttons[0], "English", buttons[1], "Java", buttons[2], "French");
buttons[0].setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q1(primaryStage, buttons[3], buttons[4], buttons[5], buttons[6], buttons[7], buttons[8], buttons[9], buttons[10], buttons[11], buttons[12], buttons[13], buttons[14], buttons[15], buttons[16], buttons[17], buttons[18], buttons[19], buttons[20], buttons[21], buttons[22], buttons[23], buttons[24], buttons[25], buttons[26], buttons[27], buttons[28], buttons[29]);
}
});
buttons[1].setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q1(primaryStage, buttons[3], buttons[4], buttons[5], buttons[6], buttons[7], buttons[8], buttons[9], buttons[10], buttons[11], buttons[12], buttons[13], buttons[14], buttons[15], buttons[16], buttons[17], buttons[18], buttons[19], buttons[20], buttons[21], buttons[22], buttons[23], buttons[24], buttons[25], buttons[26], buttons[27], buttons[28], buttons[29]);
}
});
buttons[2].setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q1(primaryStage, buttons[3], buttons[4], buttons[5], buttons[6], buttons[7], buttons[8], buttons[9], buttons[10], buttons[11], buttons[12], buttons[13], buttons[14], buttons[15], buttons[16], buttons[17], buttons[18], buttons[19], buttons[20], buttons[21], buttons[22], buttons[23], buttons[24], buttons[25], buttons[26], buttons[27], buttons[28], buttons[29]);
}
});
Group q1 = new Group(background, title, q1q, buttons[0], buttons[1], buttons[2]);
primaryStage.setScene(new Scene(q1, 1000, 800));
primaryStage.show();
}
});
Group root = new Group(background, title, playGame, couple);
primaryStage.setScene(new Scene(root, 1000, 800));
primaryStage.show();
}
static void answerButton(Button button, String answer, int layoutX, int layoutY) {
button.setText(answer);
button.setLayoutX(layoutX);
button.setLayoutY(layoutY);
button.setMinHeight(50);
button.setMinWidth(150);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
System.out.println("no");
}
});
}
static void createAnswerSet(Button button1, String button1A, Button button2, String button2A, Button button3, String button3A) {
answerButton(button1, button1A, 400, 400);
answerButton(button2, button2A, 400, 500);
answerButton(button3, button3A, 400, 600);
}
static void endScreen(ImageView yw1, ImageView yw2, ImageView yw3, ImageView yw4) {
yw1.setX(250);
yw1.setY(100);
yw2.setX(175);
yw2.setY(250);
yw3.setX(250);
yw3.setY(400);
yw4.setX(175);
yw4.setY(550);
}
static void q1(Stage primaryStage, Button b3, Button b4, Button b5, Button b6, Button b7, Button b8, Button b9, Button b10, Button b11, Button b12, Button b13, Button b14, Button b15, Button b16, Button b17, Button b18, Button b19, Button b20, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q2.png")));
title.setX(250);
title.setY(100);
ImageView q2q = new ImageView(new Image(Main.class.getResourceAsStream("q2q.png")));
q2q.setX(175);
q2q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b3, "Lowther", b4, "Graduate", b5, "Mansion Strip Club");
b3.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q2(primaryStage, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b4.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q2(primaryStage, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b5.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q2(primaryStage, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
Group q1 = new Group(background, title, q2q, b3, b4, b5);
primaryStage.setScene(new Scene(q1, 1000, 800));
primaryStage.show();
}
static void q2(Stage primaryStage,Button b6, Button b7, Button b8, Button b9, Button b10, Button b11, Button b12, Button b13, Button b14, Button b15, Button b16, Button b17, Button b18, Button b19, Button b20, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("q3q.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q3a.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b6, "13th December 2019", b7, "14th December 2019", b8, "Only Salvo Knows");
b6.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q3(primaryStage, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b7.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q3(primaryStage, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b8.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q3(primaryStage, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b6, b7, b8);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q3(Stage primaryStage, Button b9, Button b10, Button b11, Button b12, Button b13, Button b14, Button b15, Button b16, Button b17, Button b18, Button b19, Button b20, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
//incorrect sound affect
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q4.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q4q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b9, "Becky from Glee", b10, "Victoria Pedretti", b11, "Natalie Portman");
b9.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q4(primaryStage, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b10.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q4(primaryStage, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b11.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q4(primaryStage, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b9, b10, b11);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q4(Stage primaryStage, Button b12, Button b13, Button b14, Button b15, Button b16, Button b17, Button b18, Button b19, Button b20, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q5.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q5q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b12, "Prague", b13, "San Fran", b14, "Paris");
b12.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q5(primaryStage, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b13.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q5(primaryStage, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b14.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q5(primaryStage, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b12, b13, b14);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q5(Stage primaryStage, Button b15, Button b16, Button b17, Button b18, Button b19, Button b20, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q6.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q6q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b15, "Dachshund", b16, "Beagle", b17, "Huskie");
b15.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q6(primaryStage, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b16.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q6(primaryStage, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b17.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q6(primaryStage, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b15, b16, b17);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q6(Stage primaryStage, Button b18, Button b19, Button b20, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("q7.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q7q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b18, "Yes", b19, "No", b20, "Maybe so");
b18.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q7(primaryStage, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b19.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q7(primaryStage, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
b20.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q7(primaryStage, b21, b22, b23, b24, b25, b26, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b18, b19, b20);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q7(Stage primaryStage, Button b21, Button b22, Button b23, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q8.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q8q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b21, "Yates", b22, "O'Neil's", b23, "Tank & Paddle");
b21.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q8(primaryStage, b24, b25, b26, b27, b28, b29);
}
});
b22.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q8(primaryStage, b24, b25, b26, b27, b28, b29);
}
});
b23.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q8(primaryStage, b24, b25, b26, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b21, b22, b23);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q8(Stage primaryStage, Button b24, Button b25, Button b26, Button b27, Button b28, Button b29) {
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q9.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q9q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b24, "KFC", b25, "Five Guys", b26, "McDonald's");
b24.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q9(primaryStage, b27, b28, b29);
}
});
b25.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q9(primaryStage, b27, b28, b29);
}
});
b26.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q9(primaryStage, b27, b28, b29);
}
});
Group q3 = new Group(background, title, q3q, b24, b25, b26);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q9(Stage primaryStage, Button b27, Button b28, Button b29) {
//incorrect sound affect
ImageView title = new ImageView(new Image(Main.class.getResourceAsStream("Q10.png")));
title.setX(250);
title.setY(100);
ImageView q3q = new ImageView(new Image(Main.class.getResourceAsStream("q10q.png")));
q3q.setX(175);
q3q.setY(250);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
createAnswerSet(b27, "Yes", b28, "See above", b29, "See above");
b27.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q10(primaryStage);
}
});
b28.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q10(primaryStage);
}
});
b29.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
q10(primaryStage);
}
});
Group q3 = new Group(background, title, q3q, b27, b28, b29);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
static void q10(Stage primaryStage) {
ImageView yw1 = new ImageView(new Image(Main.class.getResourceAsStream("YouWin.png")));
ImageView yw2 = new ImageView(new Image(Main.class.getResourceAsStream("YouWin2.png")));
ImageView yw3 = new ImageView(new Image(Main.class.getResourceAsStream("YouWin3.png")));
ImageView yw4 = new ImageView(new Image(Main.class.getResourceAsStream("YouWin4.png")));
endScreen(yw1, yw2, yw3, yw4);
ImageView background = new ImageView(new Image(Main.class.getResourceAsStream("background.jpg")));
Group q3 = new Group(background, yw1, yw2, yw3, yw4);
primaryStage.setScene(new Scene(q3, 1000, 800));
primaryStage.show();
}
}
\ No newline at end of file
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
\ No newline at end of file
File added
/application/
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="chacobGame"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment