testing documentation

Dependencies:   mbed ll16j23s_test_docs

SnakeBody/SnakeBody.h

Committer:
JoeShotton
Date:
2020-05-23
Revision:
4:ea3fa51c4386
Parent:
3:fcd6d70e9694
Child:
6:6c9453397f4a

File content as of revision 4:ea3fa51c4386:

#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, 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);
    void update(Direction d,float mag);
    void add_score();
    int get_score();
    Vector2D get_pos();
    */
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();

    std::vector<int> _body_x;
    std::vector<int> _body_y;
    float _angle;
    int _d;
    
    /*
    int _height;
    int _width;
    int _x;
    int _y;
    int _speed;
    int _score;
    */
};
#endif