home *** CD-ROM | disk | FTP | other *** search
- # DroidWorks
- # 03_tanks_activate.cog
- #
- # This cog sends a message to 03_tanks.cog when the motor's been activated.
- #
- #
- # [01/20/98] DGS Created
- # {01/29/98] JP Modified to be used in the Moisture Farm Level.
- #
- symbols
-
- message startup
- message activate
- message timer
- message user3
- message pulse
-
- cog tanks_cog
- cog tanks2button //to tanks2button
-
- surface button
- sound sw1=swt00drswtch.wav local
- sound no=swt00twghtmax.wav local
-
- cog arrowsred
-
- end
-
- # ========================================================================================
-
- code
- startup:
- print("start me up");
- setwallcel(button, 1); //it's operational
- topbuttonworks=1;
- setpulse(0.7);
- return;
-
- activate:
- // send message to 03_Tanks_cog telling it the switch has been hit.
- if (topbuttonworks == 0)
- {
- print("notyettop");
- playsoundlocal(no, 1, 0, 0);
- //play
- }
-
- else if (topbuttonworks == 1)
- {
- sendmessage(tanks_cog, user0);
- playsoundlocal(sw1, 1, 0, 0);
- setwallcel(button, 2);
- print("foo"); //[ok]
- settimer(1);
- }
-
- return;
-
- user3:
- // tanks solution reached, so this button becomes inaccessible
- print("user3"); //[didn't make it]
- setwallcel(button, 0);
- sendmessage(tanks2button, user2);
- sendmessage(arrowsred, user2);
- topbuttonworks=0;
- print("tanks2button, user2");
- setpulse(0);
- return;
-
- timer:
- if (topbuttonworks == 0)
- {
- setwallcel(button, 0);
- }
-
- else if (topbuttonworks == 1)
- {
- setwallcel(button, 1);
- }
-
- return;
-
- pulse:
- curcel=getwallcel(button); //the blinkin' thing
- setwallcel(button, 1-curcel);
- return;
-
- end
-