-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDRDrivePen.as
44 lines (33 loc) · 890 Bytes
/
DRDrivePen.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
class DRDrivePen extends DRPen {
static var pen:DRDrivePen;
var course:DRCourse;
var car:DRCar;
var cursor:MovieClip;
function DRDrivePen() {
super("drive");
}
function onPenDown() {
this.course = DRCourse.course;
this.car = DRCar.car;
course.setVisibility("course");
cursor = course.clip.vehicles.attachMovie("Cursor", "Cursor_1", 2);
cursor._x = _xmouse;
cursor._y = _ymouse;
}
function onMouseDown() {
if (! car.isInPlay()) {
car.putInPlay(_xmouse, _ymouse);
}
}
function onMouseMove() {
if (car) {
cursor._x = _xmouse;
cursor._y = _ymouse;
}
}
function onEnterFrame() {
if (car.isInPlay()) {
car.moveTowards(_xmouse, _ymouse);
}
}
}