ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

shot Class Reference

shot Class Reference

shot class More...

#include <shot.h>

Public Member Functions

 shot ()
 constructor
 ~shot ()
 destructor
void init ()
 generate first 7 shots vector include position type direction by iterating through the vector
void init_pos (shot_posandtype *i)
 produce a init position of shots((21,0);(42,0);(63,0);(21,45);(42,45);(63,45))
void update ()
 update shots in their directions
void update_shot ()
 resize shots as time goes on generate shots in empty vector
void draw (N5110 &lcd)
 draw updated shots iterating through the vector
void delete_shot ()
 if beyoud border, delete it and generate new one, keep total number constant
void gen_shot (int timer_flag, float increment, int max)
 control difficulty of game(size)
void set_size (int size)
 accessors set the size of shots
void set_shot (int x, int y, int type, int Direction)
 accessors create a shot vector for testing
int get_size ()
 mutators get size
Vector2D get_shot ()
 mutators get position of the shot for testing

Detailed Description

shot class

set several kinds of shot and come from all around

Author:
Zeyu Feng @13 April 2020

Definition at line 24 of file shot.h.


Constructor & Destructor Documentation

shot (  )

constructor

Definition at line 21 of file shot.cpp.

~shot (  )

destructor

Definition at line 26 of file shot.cpp.


Member Function Documentation

void delete_shot (  )

if beyoud border, delete it and generate new one, keep total number constant

Definition at line 127 of file shot.cpp.

void draw ( N5110 lcd )

draw updated shots iterating through the vector

Definition at line 114 of file shot.cpp.

void gen_shot ( int  timer_flag,
float  increment,
int  max 
)

control difficulty of game(size)

Parameters:
timerflag(int)
increment(float)per 1/6 s
max(int)

Definition at line 146 of file shot.cpp.

Vector2D get_shot (  )

mutators get position of the shot for testing

Definition at line 178 of file shot.cpp.

int get_size (  )

mutators get size

Returns:
current size

Definition at line 173 of file shot.cpp.

void init (  )

generate first 7 shots vector include position type direction by iterating through the vector

Definition at line 31 of file shot.cpp.

void init_pos ( shot_posandtype i )

produce a init position of shots((21,0);(42,0);(63,0);(21,45);(42,45);(63,45))

Parameters:
vector_i(shot_posandtype*)

Definition at line 46 of file shot.cpp.

void set_shot ( int  x,
int  y,
int  type,
int  Direction 
)

accessors create a shot vector for testing

Definition at line 164 of file shot.cpp.

void set_size ( int  size )

accessors set the size of shots

Parameters:
size(int)

Definition at line 159 of file shot.cpp.

void update (  )

update shots in their directions

Definition at line 77 of file shot.cpp.

void update_shot (  )

resize shots as time goes on generate shots in empty vector

Definition at line 102 of file shot.cpp.