![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
testing documentation
Dependencies: mbed ll16j23s_test_docs
SnakeBody/SnakeBody.h
- Committer:
- JoeShotton
- Date:
- 2020-05-26
- Revision:
- 10:a2d643b3c782
- Parent:
- 9:0571880085cc
- Child:
- 12:33a5cff31339
File content as of revision 10:a2d643b3c782:
#ifndef SNAKEBODY_H #define SNAKEBODY_H #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include <vector> /** SnakeBody Class @author Joseph Shotton @brief All functions that exclusively control the snake body @date May 2020 @version V1.0 */ class SnakeBody { struct Direction { 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 init(); void add_length(int increase); void run(Gamepad &pad, N5110 &lcd, bool &_death); //draw, movement, snake-snakecollision void reset(); int _x_head; int _y_head; std::vector<int> _body_x; std::vector<int> _body_y; private: void snake_movement(Gamepad &pad); void draw_body(N5110 &lcd); void snake_snake_collision(Gamepad &pad, bool &_death); void update_direction(); void update_position(); void update_body(); float _angle; int _d; int _move_state; int _length; int _length_increase; }; #endif