Commit 8f728c2e authored by Nelson Phillips's avatar Nelson Phillips
Browse files

autosave

parent 7cbc2386
...@@ -7,19 +7,36 @@ ...@@ -7,19 +7,36 @@
using namespace std; using namespace std;
void Snake::movement(char input){ void Snake::movement(char input){
if(input == 'w'|| input == 'W') if((input == 'w'|| input == 'W')&& direction != 3 )
x--; direction = 1;
else else
if(input == 'a'|| input == 'A') if((input == 'a'|| input == 'A')&& direction != 2 )
y--; direction = 4;
else
if((input == 's'|| input == 'S')&& direction != 1 )
direction = 3;
else else
if(input == 's'|| input == 'S') if((input == 'd'|| input == 'D')&& direction != 4 )
x++; direction = 2;
if(direction == 1)
x--;
else
if(direction == 4)
y--;
else else
if(input == 'd'|| input == 'D') if(direction == 3)
y++; x++;
else
if(direction == 2)
y++;
} }
...@@ -63,8 +80,9 @@ score++; ...@@ -63,8 +80,9 @@ score++;
} }
bool Snake::direction(){
void Snake::bodied(){
} }
......
...@@ -11,20 +11,20 @@ class Snake { ...@@ -11,20 +11,20 @@ class Snake {
void draw(); void draw();
int snekoScore(); int snekoScore();
void clrScreen(); void clrScreen();
void bodied();
char input; char input;
private: private:
int x = 0, y = 0, i = 0, q = 0, score = 0, int x = 0, y = 0, i = 0, q = 0, score = 0,
h = (rand() % 14), o = (rand() % 14); h = (rand() % 14), o = (rand() % 14);
char grid[15][30]; char grid[15][30];
int randChar = (rand() % 5); int randChar = (rand() % 5);
char whtSpace = ' '; char whtSpace = ' ';
vector<Body>parts(); int direction = 5;
}; //vector<Body>parts();
};
class Body { class Body {
public: public:
private: private:
int x, y; int x, y;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment