ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Ball/Ball.h

Committer:
shahidsajid
Date:
2019-05-01
Revision:
26:6427f09cf8d3
Parent:
20:9d21599fe350
Child:
28:d0b0a64a832d

File content as of revision 26:6427f09cf8d3:

#ifndef BALL_H
#define BALL_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Bat.h"
/** Ball Class
@author Shahid Zubin Sajid
@brief Controls the ball in the Hero Cricket Game 
@date May 2019
*/ 
class Ball
{

public:
    Ball();
    ~Ball();
    void init(int size,int speed);
    void draw(N5110 &lcd);
    void reset();
    void reset_ball_count();
    
    /// accessors and mutators
    int ball_start(Gamepad &pad);
    void get_direction(Gamepad &pad);
    int get_ball_count();

    //void update_ball(int checkHit, Direction dir);
    int update_ball(int expected_x,int expected_y);
    int bowler_start(Gamepad &pad);
    void increment_ball_count();
    
private:
    struct Fielder{
        Direction dir;
        int x;
        int y;
        int position;
    };
    int fieldNumbers[10];
    Bat bat;
    int _ball_count;
    int _bowled;
    int _set_tone;
    int d;
    int _size;
    int _x;
    int _y;
    int _x1;
    int _y1;
};
#endif