-
Notifications
You must be signed in to change notification settings - Fork 2
/
BoneController.asc
60 lines (51 loc) · 1.23 KB
/
BoneController.asc
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
// new module script
#define NBONES 3
Character * ar_bone[NBONES];
void game_start(){
ar_bone[0] = cBone1;
ar_bone[1] = cBone2;
ar_bone[2] = cBone3;
}
void ForceTrashBones(){
int i=0;
while(i<NBONES){
ar_bone[i].ChangeRoom(TRASH);
i++;
}
}
Character * SpawnBone(int x, int y){
int i=0;
while(i<NBONES){
if(ar_bone[i].Room == TRASH){
ar_bone[i].ChangeRoom(player.Room, x, y);
ar_bone[i].Animate(0, 3, eRepeat, eNoBlock, eForwards);
ar_bone[i].PlaceOnWalkableArea();
int walkx = ar_bone[i].x;
int walky = ar_bone[i].y;
ar_bone[i].x = x;
ar_bone[i].y = y;
ar_bone[i].TweenPosition(0.7, walkx, walky, eEaseInExpoTween, eNoBlockTween);
return ar_bone[i];
}
i++;
}
return null;
}
void TrashBone(Character * aBoneToTrash){
aBoneToTrash.ChangeRoom(TRASH);
}
Character * whichBoneCollidesDog(){
int i=0;
while(i<NBONES){
if(ar_bone[i].IsCollidingWithChar(cDog)) {
return ar_bone[i];
}
i++;
}
return null;
}
void on_event (EventType event, int data){
if(event == eEventLeaveRoom || event == eEventEnterRoomBeforeFadein){
ForceTrashBones();
}
}