-
Notifications
You must be signed in to change notification settings - Fork 0
/
Items.java
67 lines (58 loc) · 2.03 KB
/
Items.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
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Image;
import java.util.ArrayList;
public class Items{
private Image pillowImg = new ImageIcon("Resource/pillow1.png").getImage();
private Image keyImg = new ImageIcon("Resource/key1.png").getImage();
private Image doorImg = new ImageIcon("Resource/door1.png").getImage();
private JLabel pillowLabel;
public Integer centerX = 0;
public Integer centerY = 0;
public Integer pillowMove=50;
public Integer keyMove=50;
public Integer keyX = 0;
public Integer keyY = 0;
public Integer keyWidth=0;
public Integer keyHeight=0;
public boolean keyMode=true;
public Items(RoomPanel roomPanel){
this.keyX = roomPanel.getWidth()/2+roomPanel.getWidth()/17;
this.keyY = roomPanel.getHeight()/2+keyMove+roomPanel.getHeight()/16;
this.keyWidth = roomPanel.getWidth()/30;
this.keyHeight = roomPanel.getHeight()/30;
}
public Integer getKeyX(){
return keyX;
}
public Integer getKeyY(){
return keyY;
}
public Integer getKeyWidth(){
return keyWidth;
}
public Integer getKeyHeight(){
return keyHeight;
}
public Image getDoorImg(){
return doorImg;
}
public Image getKeyImg(){
return keyImg;
}
public Image getPillowImg(){
return pillowImg;
}
public static JLabel setItemLoc(ImageIcon targetIcon,Image targetImage,String photoLocation,JLabel targetLabel,String labelName,int width,int height,int locationX,int locationY,JPanel addPanel){
targetIcon=new ImageIcon(photoLocation);
targetLabel=new JLabel(labelName);
targetImage = targetIcon.getImage();
targetImage =targetImage.getScaledInstance(width,height,Image.SCALE_DEFAULT);
targetIcon.setImage(targetImage);
targetLabel.setIcon(targetIcon);
targetLabel.setBounds(locationX,locationY,width,height);
addPanel.add(targetLabel);
return targetLabel;
}
}