/include/sssnakesss.hpp |
---|
16,7 → 16,10 |
void run(); |
void checkEvents(); |
void update(); |
void motion(); |
void draw(); |
void initLevel(int level); |
/src/sssnakesss.cpp |
---|
143,11 → 143,10 |
void SSSNAKESSS::motion() |
{ |
snake * s; |
for (int i = 0; i < snakes.size(); i++) |
for (unsigned int i = 0; i < snakes.size(); i++) |
{ |
s = snakes[i]; |
s.move(); |
Snake *s = snakes[i]; |
s->move(); |
} |
} |
/src/snake.cpp |
---|
23,13 → 23,20 |
{ |
switch (direction) |
{ |
case up: |
case Up: |
nextPoint(Point(points[0].X, points[0].Y - 1)); |
case down: |
break; |
case Down: |
nextPoint(Point(points[0].X, points[0].Y + 1)); |
case left: |
break; |
case Left: |
nextPoint(Point(points[0].X - 1, points[0].Y)); |
case right: |
break; |
case Right: |
nextPoint(Point(points[0].X + 1, points[0].Y)); |
break; |
} |
} |