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: Map/Map.cpp
- Revision:
- 14:9861fe85c803
- Parent:
- 10:8bf3713d9e9c
- Child:
- 15:876c047a6ec9
--- a/Map/Map.cpp Wed Apr 03 13:42:58 2019 +0000 +++ b/Map/Map.cpp Thu Apr 04 18:19:26 2019 +0000 @@ -1,10 +1,12 @@ #include "Map.h" +// Constructor and destructor Map::Map() {} Map::~Map() {} void Map::init(int y) { + // Starting values for the platforms _line_1.x_start = 0; _line_1.x_end = 15; _line_1.y = y; @@ -17,7 +19,9 @@ } void Map::generate_line_1(int length) { - _line_1.x_start--; + // Always move the line from L to R, and only move the end of the line + // if the start has not gone off the screen. If it has, start again. + _line_1.x_start--; if(_line_1.x_start < 80 - length) _line_1.x_end--; if(_line_1.x_start <= 0) _line_1.x_start = 0; if(_line_1.x_end <= 0) { @@ -25,8 +29,7 @@ _line_1.x_end = 80; } } - - + void Map::generate_line_2(int length) { _line_2.x_start--; if(_line_2.x_start < 80 - length) _line_2.x_end--;