-
Notifications
You must be signed in to change notification settings - Fork 0
/
coin.java
66 lines (58 loc) · 1.75 KB
/
coin.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
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javax.swing.plaf.basic.BasicInternalFrameUI.InternalFramePropertyChangeListener;
import javafx.animation.Animation;
import javafx.animation.AnimationTimer;
import javafx.animation.TranslateTransition;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
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.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
import javafx.scene.Node;
public class coin {
private int health;
private Image cimg = new Image("assets/Coin.png");
private ImageView coin;
private AnchorPane pane1;
private TranslateTransition transy;
private TranslateTransition transx;
public coin(AnchorPane p1, int x, int y, int X, int Y) {
health = 2;
transy = new TranslateTransition();
transx = new TranslateTransition();
pane1 = p1;
coin = new ImageView(cimg);
coin.setFitHeight(y);
coin.setFitWidth(x);
coin.setX(X);
coin.setY(Y);
// pane1 =pane;
p1.getChildren().add(coin);
}
public ImageView getCoin() {
return coin;
}
public int getVal() {
return health;
}
public void setVal() {
health--;
}
}