-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBottle2.java
46 lines (45 loc) · 1.16 KB
/
Bottle2.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
/*
* 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.net.URL;
import javax.swing.ImageIcon;
/**
*
* @author ACER
*/
public class Bottle2 extends Bottle1{
Image img2;
public Bottle2() {
URL imageURL = this.getClass().getResource("bottle2.png");
img2 = 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(5);
}
if(check=false){
dropper.sleep(1);
}
}catch(InterruptedException e){}
}
}
});
public Image getImg(){
return img2;
}
}