-
Notifications
You must be signed in to change notification settings - Fork 1
/
DESIGN.txt
46 lines (41 loc) · 1.08 KB
/
DESIGN.txt
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
The concept here is an Air Traffic Controller simulator.
The player will click and drag airplanes to change their direction, and try not to let the planes crash.
The game is over if the time runs out (in which case you win), all the planes reach their destination
(also a winning scenario), or (losing scenarios ahead): two planes collide, or a plane runs out of fuel.
Among the classes that will be needed are:
StartScreen
InstructionsScreen
DifficultyScreen
Airplane
Region
Angle
Angle class:
```
static class Angle {
public static float normalize(float theta) {
return ((theta % (2*PI)) + (2*PI)) % (2*PI);
}
/**
* Computes "b-a" in angular terms, i.e. the smallest
* (in terms of magnitude) angle x such that a+x = b.
*/
public static float sub(float b, float a) {
a = normalize(a);
b = normalize(b);
float diff = b-a;
float mag = abs(diff);
float answer = b-a;
if (mag < PI) {
return answer;
}
else {
if (answer > 0) {
return answer-2*PI;
}
else {
return 2*PI-answer;
}
}
}
}
```