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: Floors/Floors.cpp
- Revision:
- 13:10851784af9a
- Parent:
- 12:c5123abb4fbe
- Child:
- 14:529f798adae4
diff -r c5123abb4fbe -r 10851784af9a Floors/Floors.cpp --- a/Floors/Floors.cpp Wed Apr 17 17:53:27 2019 +0000 +++ b/Floors/Floors.cpp Thu Apr 18 14:54:51 2019 +0000 @@ -9,7 +9,9 @@ _height = height; _width = width; // x-coordinate initially random: screen =84 (visible to 84-FLOORS_WIDTH): 0 left, 70 right - _pos.x = rand()% 74; + int _array[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74}; + // excluding centre so doodler falls to the floor at bottom + _pos.x = _array[rand()%(sizeof(_array) / sizeof *_array)]; _pos.y = y; } @@ -21,7 +23,7 @@ // when they leave the screen they will re-appear in random x-coordinate so that 10 floors are always on screen _pos = get_pos(); if (_pos.y > 48 ){ - _pos.y = 0; + _pos.y = 0; _pos.x = rand()% 74; } set_pos(_pos);