Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: shot/shot.cpp
- Revision:
- 8:8287d2ef965d
- Parent:
- 7:c49f3d3b672f
- Child:
- 9:62d6559f0d50
--- a/shot/shot.cpp Wed Apr 29 05:10:57 2020 +0000 +++ b/shot/shot.cpp Wed Apr 29 15:20:34 2020 +0000 @@ -1,10 +1,10 @@ #include "shot.h" int shots[4][3][3] = { - { {1,1,0},{1,1,0},{0,0,1}, }, - { {1,0,0},{1,1,1},{1,0,0}, }, + { {0,1,0},{1,1,1},{0,1,0}, }, + { {1,1,1},{0,1,1},{0,0,1}, }, { {1,1,1},{0,1,0},{0,1,0}, }, - { {0,1,0},{1,1,1},{0,1,0}, } + { {1,1,0},{1,1,0},{0,0,1}, } }; shot::shot() @@ -74,8 +74,6 @@ } } - - void shot::update() { for (std::vector<shot_posandtype>::iterator i = _p.begin(); i < _p.end(); i++) { @@ -114,10 +112,24 @@ { for (std::vector<shot_posandtype>::iterator i = _p.begin(); i < _p.end(); i++) { // if beyoud border, delete it and generate new one, keep total number constant - if(((*i).x < 0)||((*i).x > WIDTH)||((*i).y < 0)||((*i).y > HEIGHT)) { + if(((*i).x < 0)||((*i).x > WIDTH)||((*i).y < 0)||((*i).y > HEIGHT)|| + //keep shots away from starting point + (((*i).x==33)&&((*i).y==3))||(((*i).x==48)&&((*i).y==3))||(((*i).x==33)&&((*i).y==45))||(((*i).x==48)&&((*i).y==45))) + { init_pos(i); (*i).type = ((*i).type + 2)%4; (*i).dir = ((*i).dir + 1)%6; // increase randomness } } } + +void shot::set_size(int size) { + _size = size; +} + +int shot::get_size() { + return _size; +} + + + \ No newline at end of file