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
Map/Map.cpp@10:8bf3713d9e9c, 2019-03-26 (annotated)
- Committer:
- lewisgw
- Date:
- Tue Mar 26 11:03:05 2019 +0000
- Revision:
- 10:8bf3713d9e9c
- Parent:
- 9:fff2009f826e
- Child:
- 14:9861fe85c803
Now an upper level of moving platforms that the skater can interact with.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lewisgw | 6:8741d2011692 | 1 | #include "Map.h" |
lewisgw | 6:8741d2011692 | 2 | |
lewisgw | 9:fff2009f826e | 3 | Map::Map() {} |
lewisgw | 6:8741d2011692 | 4 | |
lewisgw | 9:fff2009f826e | 5 | Map::~Map() {} |
lewisgw | 6:8741d2011692 | 6 | |
lewisgw | 10:8bf3713d9e9c | 7 | void Map::init(int y) { |
lewisgw | 9:fff2009f826e | 8 | _line_1.x_start = 0; |
lewisgw | 9:fff2009f826e | 9 | _line_1.x_end = 15; |
lewisgw | 10:8bf3713d9e9c | 10 | _line_1.y = y; |
lewisgw | 9:fff2009f826e | 11 | _line_2.x_start = 25; |
lewisgw | 9:fff2009f826e | 12 | _line_2.x_end = 50; |
lewisgw | 10:8bf3713d9e9c | 13 | _line_2.y = y; |
lewisgw | 9:fff2009f826e | 14 | _line_3.x_start = 60; |
lewisgw | 9:fff2009f826e | 15 | _line_3.x_end = 80; |
lewisgw | 10:8bf3713d9e9c | 16 | _line_3.y = y; |
lewisgw | 9:fff2009f826e | 17 | } |
lewisgw | 6:8741d2011692 | 18 | |
lewisgw | 6:8741d2011692 | 19 | void Map::generate_line_1(int length) { |
lewisgw | 9:fff2009f826e | 20 | _line_1.x_start--; |
lewisgw | 9:fff2009f826e | 21 | if(_line_1.x_start < 80 - length) _line_1.x_end--; |
lewisgw | 9:fff2009f826e | 22 | if(_line_1.x_start <= 0) _line_1.x_start = 0; |
lewisgw | 9:fff2009f826e | 23 | if(_line_1.x_end <= 0) { |
lewisgw | 9:fff2009f826e | 24 | _line_1.x_start = 80; |
lewisgw | 9:fff2009f826e | 25 | _line_1.x_end = 80; |
lewisgw | 9:fff2009f826e | 26 | } |
lewisgw | 9:fff2009f826e | 27 | } |
lewisgw | 6:8741d2011692 | 28 | |
lewisgw | 6:8741d2011692 | 29 | |
lewisgw | 6:8741d2011692 | 30 | void Map::generate_line_2(int length) { |
lewisgw | 9:fff2009f826e | 31 | _line_2.x_start--; |
lewisgw | 9:fff2009f826e | 32 | if(_line_2.x_start < 80 - length) _line_2.x_end--; |
lewisgw | 9:fff2009f826e | 33 | if(_line_2.x_start <= 0) _line_2.x_start = 0; |
lewisgw | 9:fff2009f826e | 34 | if(_line_2.x_end <= 0) { |
lewisgw | 9:fff2009f826e | 35 | _line_2.x_start = 80; |
lewisgw | 9:fff2009f826e | 36 | _line_2.x_end = 80; |
lewisgw | 9:fff2009f826e | 37 | } |
lewisgw | 9:fff2009f826e | 38 | } |
lewisgw | 6:8741d2011692 | 39 | |
lewisgw | 6:8741d2011692 | 40 | void Map::generate_line_3(int length) { |
lewisgw | 9:fff2009f826e | 41 | _line_3.x_start--; |
lewisgw | 9:fff2009f826e | 42 | if(_line_3.x_start < 80 - length) _line_3.x_end--; |
lewisgw | 9:fff2009f826e | 43 | if(_line_3.x_start <= 0) _line_3.x_start = 0; |
lewisgw | 9:fff2009f826e | 44 | if(_line_3.x_end <= 0) { |
lewisgw | 9:fff2009f826e | 45 | _line_3.x_start = 80; |
lewisgw | 9:fff2009f826e | 46 | _line_3.x_end = 80; |
lewisgw | 9:fff2009f826e | 47 | } |
lewisgw | 9:fff2009f826e | 48 | } |
lewisgw | 9:fff2009f826e | 49 | |
lewisgw | 9:fff2009f826e | 50 | Line Map::get_line_1() { |
lewisgw | 9:fff2009f826e | 51 | return _line_1; |
lewisgw | 9:fff2009f826e | 52 | } |
lewisgw | 6:8741d2011692 | 53 | |
lewisgw | 9:fff2009f826e | 54 | Line Map::get_line_2() { |
lewisgw | 9:fff2009f826e | 55 | return _line_2; |
lewisgw | 9:fff2009f826e | 56 | } |
lewisgw | 9:fff2009f826e | 57 | |
lewisgw | 9:fff2009f826e | 58 | Line Map::get_line_3() { |
lewisgw | 9:fff2009f826e | 59 | return _line_3; |
lewisgw | 9:fff2009f826e | 60 | } |
lewisgw | 6:8741d2011692 | 61 | |
lewisgw | 6:8741d2011692 | 62 | |
lewisgw | 9:fff2009f826e | 63 |