-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCatcher.as
44 lines (38 loc) · 844 Bytes
/
Catcher.as
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
package {
import flash.display.MovieClip;
public class Catcher extends MovieClip{
public var cp1:ControlPoint = null;
public var cp2:ControlPoint = null;
public var ready:Boolean = false;
public function Catcher() {
// constructor code
}
public function addPoint(newPoint:ControlPoint) {
if(cp1 == null) {
trace("add cp1");
cp1 = newPoint;
} else if(cp2 == null) {
trace("add cp2");
cp2 = newPoint;
} else {
trace("overloaded");
}
if(cp1 != null && cp2 != null) {
trace("catcher ready");
ready = true;
this.visible = true;
}
}
public function removePoint(deadCp) {
if (deadCp == cp1) {
cp1 = null;
ready = false;
this.visible = false;
} else if(deadCp == cp2) {
cp2 = null;
ready = false;
this.visible = false;
}
}
}
}