-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheatCode.java
66 lines (59 loc) · 1.46 KB
/
CheatCode.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
package Game.main;
import java.awt.event.KeyEvent;
public class CheatCode {
static private boolean [] ATTARI = new boolean [8]; //UP UP DOWN DOWN LEFT RIGHT ENTER . <- resets code
CheatCode(){
resetATTARI();
}
public static void resetATTARI(){
ATTARI = KeyInput.memset(ATTARI, 8, false);
}
static public boolean checkCode(int key){
if(ATTARI[0]){
if(ATTARI[1]){
if(ATTARI[2]){
if(ATTARI[3]){
if(ATTARI[4]){
if(ATTARI[5]){
if(ATTARI[6]){
resetATTARI();
return true;
} else if(key == KeyEvent.VK_ENTER){
ATTARI[6] = true;
System.out.println("ENTER");
}
} else if(key == KeyEvent.VK_RIGHT){
ATTARI[5] = true;
System.out.println("RIGHT");
}
}else if(key == KeyEvent.VK_LEFT){
ATTARI[4] = true;
System.out.println("LEFT");
}
}else if(key == KeyEvent.VK_DOWN){
ATTARI[3] = true;
System.out.println("DOWN");
}
}else if(key == KeyEvent.VK_DOWN){
ATTARI[2] = true;
System.out.println("DOWN");
}
}else if(key == KeyEvent.VK_UP){
ATTARI[1] = true;
System.out.println("UP");
}
}else if(key == KeyEvent.VK_UP){
ATTARI[0] = true;
System.out.println("UP");
}else {
resetATTARI();
}
return false;
}
static public boolean exit(int key){
if(key == KeyEvent.VK_PERIOD){
return true;
}
return false;
}
}