-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT1Fans.java
More file actions
61 lines (48 loc) · 1.38 KB
/
Copy pathT1Fans.java
File metadata and controls
61 lines (48 loc) · 1.38 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
/**
* T1Fans.java
* Table 1
* Daniel Alexander Miranda
*
* Responsibilities:
* - Show visual effects when triggered (e.g., stars, emojis)
* - Trigger effects based on score or gameplay events
* - Keep drawing lightweight and graphics-native
*/
import java.awt.*;
public class T1Fans {
private boolean showStars = false;
private int frame = 0;
public void triggerStars() {
showStars = true;
frame = 0;
}
public void draw(Graphics g) {
if (!showStars) return;
int numFans = 8;
int spacing = 80;
int fanWidth = 20;
int fanHeight = 35;
//RED fans
g.setColor(Color.RED);
for (int i = 0; i < numFans; i++) {
int x = 100 + i * spacing;
int phase = (frame + i * 3) % 10;
int jumpY = (phase < 5) ? -10 : 0;
int y = 30 + jumpY;
g.fillOval(x, y, fanWidth, fanHeight);
}
// BLUE fans
g.setColor(Color.BLUE);
for (int i = 0; i < numFans; i++) {
int x = 100 + i * spacing;
int phase = (frame + i * 3) % 10;
int jumpY = (phase < 5) ? -10 : 0;
int y = 550 + jumpY;
g.fillOval(x, y, fanWidth, fanHeight);
}
frame++;
if (frame > 30) {
showStars = false;
}
}
}