home *** CD-ROM | disk | FTP | other *** search
- #-----------------------------------------------------------------------------
- # Droidworks
- # Sample cog for a simple conversation with Bob.
- #-----------------------------------------------------------------------------
-
- symbols
- message user0 #gonk is now in stopsector
- message user2 #fulcrum going down
- message startup
- message pulse
- message user4
-
- thing target0
- thing target1
- thing target9
-
- thing gonk
-
- cog fulcrumcog
- end
-
-
- code
- startup:
- print("startup");
- player=getlocalplayerthing();
- xradius=getthingradius(player)+0.1;
- x1pos=getthingpos(target0);
- x2pos=getthingpos(target1);
- x9pos=getthingpos(target9);
- chevyx10=1;
- return;
-
- user0:
- AISetMovePos(gonk, x9pos);
- AISetLookPos(gonk, x9pos);
- targetpos=x9pos;
- setpulse(0.25);
- return;
-
- pulse:
- gonkpos=getthingpos(gonk);
- if (vectordist(gonkpos, targetpos)<.1) {
- setpulse(0);
- if (chevyx10==1) call x10story;
- }
- return;
-
- x10story:
- chevyx10=0;
- gonkpos=getthingpos(gonk);
- if (vectordist (gonkpos, getthingpos(target9)) < xradius) {
- targetpos=x1pos;
- AISetMovePos(gonk, x1pos);
- AISetLookPos(gonk, x1pos);
- setpulse(.25);
- sendmessage(fulcrumcog, user0);
- }
- return;
-
- user4:
- print("oh no.");
- return;
-
- user2:
- print("go R5, go!");
- AISetMovePos(gonk, x2pos);
- AISetLookPos(gonk, x2pos);
- targetpos=x2pos;
- setpulse(0.25);
- return;
-
- end
-
-
-