Wrap works, but stuff vanishes.
authorlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Tue, 14 Nov 2006 20:59:37 +0000 (20:59 +0000)
committerlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Tue, 14 Nov 2006 20:59:37 +0000 (20:59 +0000)
git-svn-id: svn+ssh://svn/var/repos/curfender@517 bc5cbbab-a4ec-0310-bb52-ff3d296db539

main.cpp

index e26a42b..e8b28df 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -5,6 +5,8 @@
 int score;
 int lives;
 
+int drawlocation = 0;
+
 struct game_object {
   int number; //object number
   int active; //object active, 1 or 0
@@ -18,6 +20,7 @@ struct game_object {
 };
 
 game_object process_motion(game_object object){
+
   if(object.direction==2){
     object.x = object.x+object.speed;
   };
@@ -43,6 +46,16 @@ game_object process_motion(game_object object){
      object.speed=0;
   };
 
+  //wrap check
+  if(object.y<=0){
+    object.y=object.y+560;
+    drawlocation=drawlocation+560;
+  };
+  if(object.y>=560){
+    object.y=object.y-560;
+    drawlocation=drawlocation-560;
+  };
+
   return object;
 
 }
@@ -199,7 +212,6 @@ int main(){
 
   int loopvar = 0;
   int input = 0;
-  int drawlocation = 0;
 
   cbreak();
   halfdelay(1);