diff --git a/Testings/Snake/Snake.cpp b/Testings/Snake/Snake.cpp index 314439f0eef33aa2c4e29164809460ae5962437c..681c7e935cc5e8c69f4e9ff453336cf3c050013e 100644 --- a/Testings/Snake/Snake.cpp +++ b/Testings/Snake/Snake.cpp @@ -5,8 +5,7 @@ #include "Snake.h" using namespace std; - - bool hi = 0; + Snake bdy; vector parts; @@ -116,14 +115,25 @@ if (grid [x][y] == grid[h][o] ){ int Snake::getY(){ return y; } - + int Snake::getLeng(){ + return length; + } + void Snake::lengthed(){ + length++; + } void Snake::newBody(){ - Body segment (x - length, y); - cout << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl; + Body segment (x,y);//parts[bdy.getLeng()].getX(), parts[bdy.getLeng()].getY() parts.push_back(segment); } + + + + + + + void Body::changeX(bool updown){ if (updown) x--; @@ -151,7 +161,4 @@ if (grid [x][y] == grid[h][o] ){ return y; } - void Snake::lengthed(){ - length++; - } \ No newline at end of file diff --git a/Testings/Snake/Snake.h b/Testings/Snake/Snake.h index ec60fde5878d03ddf7d239c73219b3f689f61b76..a7ab8721b0ccf1977cbf0a656ed8e9e968b739b6 100644 --- a/Testings/Snake/Snake.h +++ b/Testings/Snake/Snake.h @@ -17,6 +17,7 @@ class Snake { int getY(); void newBody(); void lengthed(); + int getLeng(); private: int x = 5, y = 5, i = 0, q = 0, score = 0, h = (rand() % 14), o = (rand() % 14); diff --git a/Testings/Snake/SnakeTest.cpp b/Testings/Snake/SnakeTest.cpp index e2b8bf190505a846e355e2f5e68136092024e7db..54088dc52460c9423cea941fcc9fc5e72bd79e9f 100644 --- a/Testings/Snake/SnakeTest.cpp +++ b/Testings/Snake/SnakeTest.cpp @@ -43,7 +43,6 @@ void charCall() { } int main() { - BrdSet.newBody(); thread first (charCall); // spawn new thread that calls input() thread second (snakePrint); // spawn new thread that calls snakePrint(0)