-
Notifications
You must be signed in to change notification settings - Fork 0
/
m2control.java
159 lines (135 loc) · 4.95 KB
/
m2control.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.animation.TranslateTransition;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
//import javafx.scene.input.DragEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.paint.CycleMethod;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.stage.Stage;
import javafx.util.Duration;
//no exeptions or shit is handled it is raw code
public class m2control implements Initializable {
@FXML
private ImageView island;
@FXML
private ImageView avatar;
@FXML
private ImageView cloud;
@FXML
private ImageView cloud2;
@FXML
private ImageView settings;
@FXML
private Label mb1;
@FXML
private Label mb2;
@FXML
private Label mb3;
@FXML
private ImageView crest;
@FXML
private ImageView isl1;
@FXML
private ImageView isl2;
@FXML
private ImageView bigorc1;
int jump = 1;
// private double x;
// private double y;
Stage stageog;
@FXML
private AnchorPane scenePane;
// Scene scene;
public void play(MouseEvent m2) throws IOException {
// avatar.setTranslateX(avatar.getX() + 50);
// avatar.setLayoutX(avatar.getLayoutX() + 50);
Stage stage;
Scene scene;
Stop[] stops = new Stop[] { new Stop(0, Color.WHITE), new Stop(1, Color.rgb(80, 200, 255)) };
LinearGradient lg1 = new LinearGradient(0, 1, 0, 0, true, CycleMethod.NO_CYCLE, stops);
Parent root = FXMLLoader.load(getClass().getResource("test.fxml"));
stage = (Stage) ((Node) m2.getSource()).getScene().getWindow();
scene = new Scene(root, lg1);
String css = this.getClass().getResource("bg.css").toExternalForm();
scene.getStylesheets().add(css);
stage.setScene(scene);
// controller c = new controller();
// c.init();
stage.show();
}
public void exit(MouseEvent m) {
// System.out.println("mouse");
stageog = (Stage) scenePane.getScene().getWindow();
stageog.close();
}
public void load(MouseEvent m2) throws IOException {
Stage stage;
Scene scene;
Stop[] stops = new Stop[] { new Stop(0, Color.WHITE), new Stop(1, Color.rgb(80, 200, 255)) };
LinearGradient lg1 = new LinearGradient(0, 1, 0, 0, true, CycleMethod.NO_CYCLE, stops);
Parent root = FXMLLoader.load(getClass().getResource("load.fxml"));
stage = (Stage) ((Node) m2.getSource()).getScene().getWindow();
scene = new Scene(root, lg1);
String css = this.getClass().getResource("bg.css").toExternalForm();
scene.getStylesheets().add(css);
stage.setScene(scene);
// controller c = new controller();
// c.init();
stage.show();
}
// public void up(ActionEvent e) {
// // System.out.println("t1");
// }
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub
TranslateTransition trans1 = new TranslateTransition();
trans1.setNode(avatar);
trans1.setDuration(Duration.millis(2000));
trans1.setByY(avatar.getY() - 10);
trans1.setCycleCount(TranslateTransition.INDEFINITE);
trans1.setAutoReverse(true);
trans1.play();// band rakh untill others are tested
// cloud
TranslateTransition trans = new TranslateTransition();
trans.setNode(cloud);
trans.setDuration(Duration.seconds(60));
trans.setByX(-700);
trans.setCycleCount(TranslateTransition.INDEFINITE);
trans.play();// band rakh untill others are tested
TranslateTransition trans2 = new TranslateTransition();
trans2.setNode(cloud2);
trans2.setDuration(Duration.seconds(60));
trans2.setByX(-500);
trans2.setCycleCount(TranslateTransition.INDEFINITE);
trans2.play();// band rakh untill others are tested
TranslateTransition trans3 = new TranslateTransition();
trans3.setNode(settings);
trans3.setDuration(Duration.seconds(1));
trans3.setByY(settings.getY() + 5);
trans3.setAutoReverse(true);
trans3.setCycleCount(TranslateTransition.INDEFINITE);
trans3.play();// band rakh untill others are tested
TranslateTransition trans4 = new TranslateTransition();
trans4.setNode(bigorc1);
trans4.setDuration(Duration.seconds(1));
trans4.setByY(bigorc1.getY() - 5);
trans4.setAutoReverse(true);
trans4.setCycleCount(TranslateTransition.INDEFINITE);
trans4.play();// band rakh untill others are tested
}
}