Repository navigation
Expand file tree
/
Copy pathPowerUpType.java
More file actions
66 lines (62 loc) · 1.77 KB
/
Copy pathPowerUpType.java
File metadata and controls
66 lines (62 loc) · 1.77 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
public enum PowerUpType {
TwoMovePerRound,
TwoFieldsBullet,
DoublePowerBullet,
BouncingBullet,
Immortality,
ExtraLife;
public PowerUpType fromInt(int n) {
switch(n) {
case 1:
return TwoMovePerRound;
case 2:
return TwoFieldsBullet;
case 3:
return DoublePowerBullet;
case 4:
return BouncingBullet;
case 5:
return ExtraLife;
case 6:
return Immortality;
}
throw new IllegalArgumentException("Incorrect power up type argument");
}
public int toInt() {
switch (this) {
case TwoMovePerRound:
return 1;
case TwoFieldsBullet:
return 2;
case DoublePowerBullet:
return 3;
case BouncingBullet:
return 4;
case ExtraLife:
return 5;
case Immortality:
return 6;
}
throw new IllegalArgumentException("Incorrect power up type argument");
}
public String toString() {
switch (this) {
case TwoMovePerRound:
return "Two Move Per Round";
case TwoFieldsBullet:
return "Two Fields Bullet";
case DoublePowerBullet:
return "Double Power Bullet";
case BouncingBullet:
return "Bouncing Bullet";
case ExtraLife:
return "Immortality";
case Immortality:
return "ExtraLife";
}
throw new IllegalArgumentException("Incorrect power up type argument");
}
public String myToString() {
return "*";
}
}