summaryrefslogtreecommitdiff
path: root/src/List.cpp
diff options
context:
space:
mode:
authortom <tom@ground-control>2015-11-21 12:30:13 -0600
committertom <tom@ground-control>2015-11-21 12:30:13 -0600
commit7f79b2e216617ff74ebd41ac02663b20ef3d0904 (patch)
treee0eb8f820c61c45afcb1506f5b025eeb7e534691 /src/List.cpp
parent032d4f98c809bde6231ff78ba50e8c244334739f (diff)
began adding collision *added a location class for ease *much refractoring needed to fully implement it*
Diffstat (limited to 'src/List.cpp')
-rw-r--r--src/List.cpp35
1 files changed, 8 insertions, 27 deletions
diff --git a/src/List.cpp b/src/List.cpp
index c0d956f..94506f4 100644
--- a/src/List.cpp
+++ b/src/List.cpp
@@ -6,8 +6,8 @@ List::List()
{
Character x ('@',4,150,150+i);
men.push_back(x);
- }
- srand(time(NULL));
+ occupied.push_back(x.getLocation());
+ }
}
void List::draw(WINDOW * w)
@@ -16,31 +16,12 @@ void List::draw(WINDOW * w)
men[i].draw(w);
}
-void List::actions()
+void List::action()
{
for(int i = 0; i < 10; i++)
- {
- int x = men[i].getRow();
- int y = men[i].getCol();
- int r = rand()%15+1;
- if(r==1)
- men[i].move(x+1,y);
- else if(r==2)
- men[i].move(x-1,y);
- else if(r==3)
- men[i].move(x,y+1);
- else if(r==4)
- men[i].move(x,y-1);
- else if(r==5)
- men[i].move(x+1,y+1);
- else if(r==6)
- men[i].move(x-1,y-1);
- else if(r==7)
- men[i].move(x+1,y-1);
- else if(r==8)
- men[i].move(x-1,y+1);
- else
- continue;
- }
-
+ if(men[i].action(occupied))
+ {
+ //rows[i] = 0;
+ //cols[i] = 0;
+ }
}