Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Snake/Snake.h

Committer:
AhmedPlaymaker
Date:
2019-04-10
Revision:
25:e827f1a8fadc
Parent:
22:ee698f66146f
Child:
36:dfdd619874ae

File content as of revision 25:e827f1a8fadc:

#ifndef Snake_H
#define Snake_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"


class Snake
{
    public:
    
    
    Snake();
    ~Snake();
    
    /** Initialise Snake
    *
    *   This function initalises the Snake library.
    */
    void init();
    
    /** Draw
    *
    *   This function draws the Snake sprite onto the screen at the specified coordinates.
    */
    int draw(Gamepad &pad, N5110 &lcd, int length, int level);
    
    /** Update
    *
    *   This function updates the Snake sprite position on screen.
    */
    void update(Direction d,float mag,int length, int speed, int* b);
    
    /** Get Position
    *
    *   This function obtains the coordinate of the top-left pixel in the Snake sprite.
    */
    Vector2D get_pos(int length);
    Vector2D get_pos_before1(int length);
    Vector2D get_pos_before2(int length);
    Vector2D get_pos_before3(int length);
    Vector2D get_pos_before4(int length);
    Vector2D get_pos_before5(int length);
    Vector2D get_pos_before6(int length);
    Vector2D get_pos_before7(int length);
    Vector2D get_pos_before8(int length);
    Vector2D get_pos_before9(int length);
    Vector2D get_pos_before10(int length);
    Vector2D get_pos_before11(int length);
    Vector2D get_pos_before12(int length);
    Vector2D get_pos_before13(int length);
    Vector2D get_pos_before14(int length);
    
    int m;
    int b[15];  //each element in this array represents the beed number in the snake.
    char bufferlevel[14];  //this helps me print the level on screen.
    private:
    int _speed;  //this is the speed of the snake flowing in the x axis.
    int _x[15];  //each element in this array represents the x position of each beed in the snake.
    int _y[15];  //each element in this array represents the y position of each beed in the snake.

};
#endif