Mochu Yao explorer game
Dependencies: mbed
Diff: item/item.cpp
- Revision:
- 8:201ef0618b7d
- Parent:
- 7:88c4ba6bb37b
- Child:
- 9:e11bb7cef050
--- a/item/item.cpp Thu Apr 23 07:49:39 2020 +0000 +++ b/item/item.cpp Mon Apr 27 08:41:29 2020 +0000 @@ -4,19 +4,12 @@ //this is the forward form of the item int item_form[6][5] = { { 0,0,1,1,0,0}, - { 0,1,0,0,1,0}, - { 1,0,0,0,0,1}, - { 0,1,0,0,1,0}, + { 0,1,1,1,1,0}, + { 1,1,1,1,1,1}, + { 0,1,1,1,1,0}, { 0,0,1,1,0,0}, }; //this is the vertical form of the item -int item_vertical[6][5] = { - { 0,0,1,1,0,0}, - { 0,0,1,1,0,0}, - { 0,0,1,1,0,0}, - { 0,0,1,1,0,0}, - { 0,0,1,1,0,0}, -}; // Constructor and destructor. item::item() {} @@ -27,17 +20,6 @@ // Starting position of the item. _x = 40; _y = 40; - _loop = 0;//the loop must be set to zero -} - -void item::generate_item() { - // make the item rotating every 4 loops - for(_loop = 0; loop<4; _loop++;) { - if (_loop == 3) { - _loop = 0; - _rotate_item = !_rotate_item; - } - wait(0.05); } void item::set_item(int random_x, int random_y) { @@ -61,12 +43,7 @@ } int *item::get_item_form() { - //by changing the form from forward to vertical each 4 loop the item can start rotating - if (_rotate_item) { return *item_form; - } else if(!_rotate_item) { - return *item_vertical; - } } int item::get_item_x() {