![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
testing documentation
Dependencies: mbed ll16j23s_test_docs
Diff: SnakeBody/SnakeBody.h
- Revision:
- 4:ea3fa51c4386
- Parent:
- 3:fcd6d70e9694
- Child:
- 6:6c9453397f4a
diff -r fcd6d70e9694 -r ea3fa51c4386 SnakeBody/SnakeBody.h --- a/SnakeBody/SnakeBody.h Wed May 20 21:25:40 2020 +0000 +++ b/SnakeBody/SnakeBody.h Sat May 23 15:31:30 2020 +0000 @@ -8,20 +8,25 @@ class SnakeBody { - struct Direction { - int output; // output value - int delta_x; // increment value for x - int delta_y; // increment value for y - int nextState[5]; // array of next states + int delta_x; // increment value for x + int delta_y; // increment value for y + int nextState[5]; // array of next states }; - public: SnakeBody(); ~SnakeBody(); - void update_movement(int x_max, int y_max, int cell_size); + void init(); + void snake_movement(Gamepad &pad); + void draw_body(N5110 &lcd); + void snake_snake_collision(Gamepad &pad, bool &death); //(int _x_head, int _y_head, vector<int> _body_x, vector<int> _body_y, int _length); + + int _state; + int _x_head; + int _y_head; + int _length; /* void init(int x,int height,int width); void draw(N5110 &lcd); @@ -32,11 +37,14 @@ */ private: - int _state; - int _x_head; - int _y_head; + int update_direction(float _angle, int _x_head, int _y_head); //int _angle, int _x_head, int _y_head + void update_position(); //int _d, int _state, int &_x_head, int &_y_head + void update_body(); + std::vector<int> _body_x; std::vector<int> _body_y; + float _angle; + int _d; /* int _height;