-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBottle1.java
65 lines (59 loc) · 1.52 KB
/
Bottle1.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package foxthefruithunter;
import java.awt.Image;
import java.awt.geom.Rectangle2D;
import java.net.URL;
import javax.swing.ImageIcon;
/**
*
* @author ACER
*/
public class Bottle1 {
Image img;
public int x=(int)(Math.random()*1200);
public int y= 0;
public int count = 0;
public boolean check=true;
public Bottle1() {
URL imageURL = this.getClass().getResource("bottle1.png");
img = new ImageIcon(imageURL).getImage();
dropper.start();
}
Thread dropper = new Thread(new Runnable() {
public void run() {
while(true){
y += 2;
if(y >= 800){
img = null;
dropper = null;
x = -500;
y = -500;
}
try{
if(check=true){
dropper.sleep(15);
}
if(check=false){
dropper.sleep(1);
}
}catch(InterruptedException e){}
}
}
});
public Image getImg() {
return img;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public Rectangle2D getbound(){
return (new Rectangle2D.Double(x,y,45,45));
}
}