Meteor defense project

Dependencies:   N5110 mbed

Revision:
6:a554424e4517
Parent:
5:c74bbdda06f4
Child:
7:3be4369131c6
--- a/Spawn/Spawn.cpp	Wed Mar 22 17:15:38 2017 +0000
+++ b/Spawn/Spawn.cpp	Thu Mar 23 19:36:33 2017 +0000
@@ -10,7 +10,7 @@
 
 }
 
-void Spawn::randomizeSpawn() {
+void Spawn::randomizeSpawn(int Arr1[][Rows], int Arr2[][Rows]) {
     
     if (stopSpawn ==0) {
         stopSpawn = 1;
@@ -20,43 +20,43 @@
             bool TrueFalse = (rand() % 100) < 20;
             if (TrueFalse) {
                 //spawning from the top of the screen
-                spawnArray1[x][0] = 1;
-                spawnArray2[x][0] = 1;
+                Arr1[x][0] = 1;
+                Arr2[x][0] = 1;
                 printf("spawn set at x = is %d \n",x);
             }
         }
-        printf("at x=2, y=0. value = %d \n",spawnArray1[2][0]);
+        printf("at x=2, y=0. value = %d \n",Arr1[2][0]);
     } else {
         stopSpawn = 0;
     }
     
 }
-void Spawn::moveSpawn() {
+void Spawn::moveSpawn(int Arr1[][Rows], int Arr2[][Rows]) {
     //printf("x=2,y =0. value = %d \n",array[2][0]);
     //scan through the whole array
     for ( int x = 0; x < Cols; x++) {
-        spawnArray2[x][0] = 0;
+        Arr2[x][0] = 0;
         for ( int y = 0; y < Rows; y++) {
-            if (spawnArray1[x][y] > 0) {
+            if (Arr1[x][y] > 0) {
                 //move it down a row
-                spawnArray2[x][y+1] = spawnArray1[x][y];       
+                Arr2[x][y+1] = Arr1[x][y];       
             } else {
-                spawnArray2[x][y+1] = 0;
+                Arr2[x][y+1] = 0;
             }
         }
     }
-    printf("at x=2, y=47. number is =%d \n",spawnArray2[2][47]);  
+    printf("at x=2, y=47. number is =%d \n",Arr2[2][47]);  
 }
 
-void Spawn::updateSpawn(N5110 &lcd) {
+void Spawn::updateSpawn(int Arr1[][Rows], int Arr2[][Rows],N5110 &lcd) {
     for ( int x = 0; x < Cols; x++) {
         for ( int y = 0; y < Rows; y++) {
-            if (spawnArray2[x][y] > 0) {
+            if (Arr2[x][y] > 0) {
                 lcd.setPixel(x,y);
                 //to update array1 
-                spawnArray1[x][y] = spawnArray2[x][y];
+                Arr1[x][y] = Arr2[x][y];
             } else {
-                spawnArray1[x][y] = 0;
+                Arr1[x][y] = 0;
             }
         }
     }