testing documentation

Dependencies:   mbed ll16j23s_test_docs

SnakeBody/SnakeBody.h

Committer:
JoeShotton
Date:
2020-05-24
Revision:
7:dd84e0fab346
Parent:
6:6c9453397f4a
Child:
8:bcc3403d7e79

File content as of revision 7:dd84e0fab346:

#ifndef SNAKEBODY_H
#define SNAKEBODY_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include <vector>

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 snake_movement(Gamepad &pad);
    void draw_body(N5110 &lcd);
    void snake_snake_collision(Gamepad &pad); //(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;
    
    std::vector<int> _body_x;
    std::vector<int> _body_y;

private:
    
    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();

    float _angle;
    int _d;
    
};
#endif