Animated gate.
authorlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Mon, 4 Dec 2006 15:39:24 +0000 (15:39 +0000)
committerlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Mon, 4 Dec 2006 15:39:24 +0000 (15:39 +0000)
git-svn-id: svn+ssh://svn/var/repos/curfender@551 bc5cbbab-a4ec-0310-bb52-ff3d296db539

CHANGELOG
main.cpp

index 6e088b0..3dc7b25 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1 +1,2 @@
+Animated gate.
 Basic gravity.
index 24bf827..819c8a3 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -128,6 +128,14 @@ game_object process_motion(game_object object, game_object player){
       };
     };
 
+    if((object.number>=11)&&(object.number<=13)){
+      if((object.face>=5)&&(object.face<6)){
+       object.face++;
+      }else{
+       object.face=5;
+      };
+    };
+
   };
   return object;
 
@@ -177,8 +185,13 @@ game_object process_direction(game_object object, int input){
     object.speed++;
   } else {
     if((input==4)||(input==6)){
+      if(object.direction!=input){
+       object.speed = 0;
+      } else {
+       object.speed = 1;
+      };
       object.direction = input;
-      object.speed = 1;
+      
     };
     if(input==2){
       object.x++;
@@ -236,6 +249,12 @@ int draw_object(game_object object, int drawlocation){
       } else if(object.face==4){
        mvprintw(object.x,offset,"%s",object.line1);
        mvprintw(object.x-1,offset,"%s",object.line0);
+      } else if(object.face==5){
+       mvprintw(object.x,offset,"%s",object.line1);
+       mvprintw(object.x-1,offset,"%s",object.line0);
+      } else if(object.face==6){
+       mvprintw(object.x,offset,"%s",object.line3);
+       mvprintw(object.x-1,offset,"%s",object.line2);
       };
     };
     
@@ -325,40 +344,46 @@ int main(){
   gatebeam1.x = 16;
   gatebeam1.y = 40;
   gatebeam1.direction = 5;
-  gatebeam1.face = 4;
+  gatebeam1.face = 5;
   gatebeam1.speed = 0;
   gatebeam1.vspeed = 0;
   gatebeam1.vtime = 0;
   strcpy (gatebeam1.line0, " ] ");
   strcpy (gatebeam1.line1, " [ ");
+  strcpy (gatebeam1.line2, " [ ");
+  strcpy (gatebeam1.line3, " ] ");
   strcpy (gatebeam1.radar, "|");
 
   game_object gatebeam2;
-  gatebeam2.number = 11;
+  gatebeam2.number = 12;
   gatebeam2.active = 1;
   gatebeam2.x = 14;
   gatebeam2.y = 40;
   gatebeam2.direction = 5;
-  gatebeam2.face = 4;
+  gatebeam2.face = 5;
   gatebeam2.speed = 0;
   gatebeam2.vspeed = 0;
   gatebeam2.vtime = 0;
   strcpy (gatebeam2.line0, " ] ");
   strcpy (gatebeam2.line1, " [ ");
+  strcpy (gatebeam2.line2, " [ ");
+  strcpy (gatebeam2.line3, " ] ");
   strcpy (gatebeam2.radar, "|");
 
   game_object gatebeam3;
-  gatebeam3.number = 11;
+  gatebeam3.number = 13;
   gatebeam3.active = 1;
   gatebeam3.x = 12;
   gatebeam3.y = 40;
   gatebeam3.direction = 5;
-  gatebeam3.face = 4;
+  gatebeam3.face = 5;
   gatebeam3.speed = 0;
   gatebeam3.vspeed = 0;
   gatebeam3.vtime = 0;
   strcpy (gatebeam3.line0, " ] ");
   strcpy (gatebeam3.line1, " [ ");
+  strcpy (gatebeam3.line2, " [ ");
+  strcpy (gatebeam3.line3, " ] ");
   strcpy (gatebeam3.radar, "|");
 
   game_object pod2;
@@ -563,6 +588,10 @@ game_object pod9;
     pod7 = process_motion(pod7, player);
     pod8 = process_motion(pod8, player);
     pod9 = process_motion(pod9, player);
+
+    gatebeam1 = process_motion(gatebeam1, player);
+    gatebeam2 = process_motion(gatebeam2, player);
+    gatebeam3 = process_motion(gatebeam3, player);
     
 
     // Draw player object 1