ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

shot/shot.h

Committer:
el19zf
Date:
2020-05-09
Revision:
9:62d6559f0d50
Parent:
8:8287d2ef965d
Child:
10:02ab3324be6c

File content as of revision 9:62d6559f0d50:

#ifndef SHOT_H
#define SHOT_H

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

/** shot class
    @set several kinds of shot and come from all around
    @author Zeyu Feng
    @13 April 2020
   */

struct shot_posandtype {
    int x;
    int y;
    int type;
    int dir;
};

class shot
{

public:
    //constructor
    shot();
    //destructor
    ~shot();
    //generate first 10 shots
    void init();
    //random pos
    void init_pos(shot_posandtype* i);
    //increase number of shots along with time
    void gen_shot();
    //moving function
    void update();

    void draw(N5110 &lcd);
    //if beyoud border, delete it and generate new one, keep total number constant
    void delete_shot();
    //accessors  
    void set_size(int size);
    ////mutators
    int get_size();

private:
    std::vector<shot_posandtype> _p;
    
    int _size;
};
#endif