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

autosave

parent 7cbc2386
......@@ -7,19 +7,36 @@
using namespace std;
void Snake::movement(char input){
if(input == 'w'|| input == 'W')
if((input == 'w'|| input == 'W')&& direction != 3 )
direction = 1;
else
if((input == 'a'|| input == 'A')&& direction != 2 )
direction = 4;
else
if((input == 's'|| input == 'S')&& direction != 1 )
direction = 3;
else
if((input == 'd'|| input == 'D')&& direction != 4 )
direction = 2;
if(direction == 1)
x--;
else
if(input == 'a'|| input == 'A')
if(direction == 4)
y--;
else
if(input == 's'|| input == 'S')
if(direction == 3)
x++;
else
if(input == 'd'|| input == 'D')
if(direction == 2)
y++;
}
......@@ -63,7 +80,8 @@ score++;
}
bool Snake::direction(){
void Snake::bodied(){
}
......
......@@ -11,21 +11,21 @@ class Snake {
void draw();
int snekoScore();
void clrScreen();
void bodied();
char input;
private:
int x = 0, y = 0, i = 0, q = 0, score = 0,
h = (rand() % 14), o = (rand() % 14);
char grid[15][30];
int randChar = (rand() % 5);
char whtSpace = ' ';
vector<Body>parts();
};
int direction = 5;
//vector<Body>parts();
};
class Body {
public:
private:
int x, y;
char piece;
......
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