home *** CD-ROM | disk | FTP | other *** search
- # Droids Cog Script
- #
- # b0_SafetyDoor.cog
- #
- # Two Switch door script for Biped obstacle course
- #
- # 10/23/97 [DGS] Created
- #
- # ========================================================================================
-
- symbols
- message startup
- message activate
- message arrived
-
- thing screw0 linkid=1
- thing screw1
- thing screw2
- thing screw3
-
- thing platform linkid=3
-
- surface Button0 linkid=2
-
- float speed=2.0
-
- sector doorSector local
- int on_button=0 local
- int rotate local
- end
-
- # ========================================================================================
-
- code
-
- startup:
- AttachThingToThing(screw1, screw0);
- AttachThingToThing(screw2, screw0);
- //AttachThingToThing(screw3, screw0);
-
- MoveToFrame(platform, 1, speed);
- //RotatePivot(screw0, 1, 1);
-
- return;
-
- # ........................................................................................
-
- activate:
- if (GetSenderId() == 2) // Turn on the gear machine
- {
- if (GetCurFrame(platform)==1)
- {
- MoveToFrame(platform, 2, speed);
- rotate = 1;
- RotatePivot(screw0, 1, 1);
- }
-
- if (GetCurFrame(platform)==2)
- {
- SkipToFrame(platform, 0, speed);
- rotate = 1;
- RotatePivot(screw0, 1, -1);
- }
- }
- return;
-
- # ........................................................................................
-
- arrived:
- if ((GetSenderId() == 1) && (rotate == 1))
- {
- RotatePivot(screw0, 1, 1);
- }
- if (GetSenderId() == 3)
- {
- RotatePivot(screw0, 1, 10000);
- rotate = 0;
- }
- return;
-
-
-
-
- end
-
-