4
1
mirror of https://github.com/QuasarApp/Snake.git synced 2025-05-03 04:59:45 +00:00
2018-09-11 22:08:08 +03:00

26 lines
376 B
C++

#include "snake.h"
const QVector<Head *> &Snake::getItems() const {
return _items;
}
Snake::Snake() :
_speed(SPEEDSNAKE){
}
bool Snake::init(int size, double spead) {
if (size < 0 || spead <= 0) {
return false;
}
_speed = spead;
for ( int i = size; i >= 0; --i ) {
_items.push_back( new Head(&_speed));
}
return true;
}