ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Ball/Ball.h

Committer:
shahidsajid
Date:
2019-04-22
Revision:
11:f481ec642cc5
Parent:
10:6c6e09023942
Child:
12:954da4f4e565

File content as of revision 11:f481ec642cc5:

#ifndef BALL_H
#define BALL_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Bat.h"
/** Ball Class
@author Dr Craig A. Evans, University of Leeds
@brief Controls the ball in the Pong game 
@date Febraury 2017
*/ 
class Ball
{

public:
    Ball();
    ~Ball();
    void init(int size,int speed);
    void draw(N5110 &lcd);
    Vector2D get_pos();
    void set_pos(Vector2D p);
    
    void update();
    /// accessors and mutators
    int ball_start();
    void get_direction(Gamepad &pad);

    void update_ball(int checkHit, Direction dir);
    int bowler_start();
    void reset();
    
private:
    Gamepad pad;
    struct Fielder{
        Direction dir;
        int x;
        int y;
        int position;
    };
    int fieldNumbers[10];
    Bat bat;
    int ballHit;
    Vector2D _velocity;
    Direction ball_direction;
    Direction _d;
    int bowled;
    int d;
    int _size;
    int _x;
    int _y;
    int _x1;
    int _y1;
};
#endif