-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReward.java
78 lines (60 loc) · 1.8 KB
/
Reward.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
import java.awt.Image;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.ImageIcon;
public class Reward {
private int posx;
private int posy;
private String type;
private boolean visible;
private Image image;
public Reward(int posx, int posy, String type) {
this.posx = posx;
this.posy = posy;
this.type = type;
this.visible = true;
loadImage(type);
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
}
}, 5 * 100);
}
}, 2 * 1000);
}
public int getPosx() {
return posx;
}
public int getPosy() {
return posy;
}
public void setPosx(int posx) {
this.posx = posx;
}
public void setPosy(int posy) {
this.posy = posy;
}
public Image getImage() {
return this.image;
}
public String getType() {
return type;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public boolean getVisible() {
return visible;
}
private void loadImage(String type) {
ImageIcon imageIcon = new ImageIcon("Resources/" + this.type + ".png"); // load the image to a imageIcon
Image scimage = imageIcon.getImage(); // transform it
this.image = scimage.getScaledInstance((int) TankGame.getImgSizeReward(), (int) TankGame.getImgSizeReward(),
java.awt.Image.SCALE_SMOOTH);
}
}