-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNote.java
More file actions
112 lines (101 loc) · 2.52 KB
/
Copy pathNote.java
File metadata and controls
112 lines (101 loc) · 2.52 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package Mstw;
import javax.swing.*;
import java.awt.*;
public class Note extends Thread{
private Image noteBasicImage = new ImageIcon(Main.class.getResource("../images/noteBasic.png")).getImage();
private int x, y = 600 - (1000 / Main.sleep_time * Main.note_speed) * Main.reach_time;
private String noteType;
private boolean proceeded = true;
public boolean isProceeded() {
return proceeded;
}
public String getNoteType(){
return noteType;
}
public void close() {
proceeded = false;
}
public Note(String noteType){
if(noteType.equals("S")){
x = 424;
}
if(noteType.equals("D")){
x = 578;
}
if(noteType.equals("F")){
x = 732;
}
if(noteType.equals("Space")){
x = 886;
}
if(noteType.equals("J")){
x = 1040;
}
if(noteType.equals("K")){
x = 1194;
}
if(noteType.equals("L")){
x = 1348;
}
this.noteType = noteType;
}
public void screenDraw(Graphics2D g){
g.drawImage(noteBasicImage, x, y, null);
}
//方块下落函数
public void drop(){
y += Main.note_speed; //以一个速度下落
//方块超出判定区就消失,并且算Miss
if (y > 965){
System.out.println("Miss");
close();
}
}
@Override
public void run(){
try{
while (true){
drop();
if (proceeded){
Thread.sleep(Main.sleep_time);
}
else {
interrupt();
break;
}
}
} catch (Exception e){
e.printStackTrace();
}
}
public String judge(){
if (y > 935){
System.out.println("Late");
Main.scout += 10;
close();
return "Late";
}
else if (y > 915){
System.out.println("Good");
Main.scout += 20;
close();
return "Good";
}
else if (y > 895){
System.out.println("Prefect");
Main.scout += 40;
close();
return "Prefect";
}
else if (y > 875){
System.out.println("Early");
Main.scout += 10;
close();
return "Early";
}
return "None";
}
public int getY(){
return y;
}
}