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.
Diff: Level/Level.cpp
- Revision:
- 8:21b6d4dbce44
- Parent:
- 7:68e06dda79f7
- Child:
- 9:96969b1c6bde
--- a/Level/Level.cpp Wed Apr 17 12:39:46 2019 +0000
+++ b/Level/Level.cpp Fri Apr 19 17:54:09 2019 +0000
@@ -4,28 +4,49 @@
Level::~Level() {}
-void Level::init(Block blocks [] ,int number_of_blocks)
+void Level::init(Block blocks [],MovingBlock moving_blocks [],
+ int number_of_blocks,
+ int number_of_moving_blocks,
+ Vector2D goal)
{
-
- for (int i = 0;i<_number_of_blocks;i++) {
- _blocks[i].first.x = blocks[i].first.x;
- _blocks[i].first.y = blocks[i].first.y;
- _blocks[i].second.x = blocks[i].second.x;
+ _number_of_blocks = number_of_blocks;
+ _number_of_moving_blocks = number_of_moving_blocks;
+
+
+ for (int i = 0; i<_number_of_blocks; i++) {
+ _blocks[i].first.x = blocks[i].first.x;
+ _blocks[i].first.y = blocks[i].first.y;
+ _blocks[i].second.x = blocks[i].second.x;
_blocks[i].second.y = blocks[i].second.y;
}
- _number_of_blocks = number_of_blocks;
+
+ for (int i = 0; i<_number_of_moving_blocks; i++) {
+ _moving_blocks[i] = moving_blocks[i];
+ }
+
+
+ _goal = goal;
}
+void Level::update()
+{
+
+}
+
+
+
void Level::render(N5110 &lcd)
{
-
-
- for (int i = 0;i<_number_of_blocks;i++) {
-
- lcd.drawRect(_blocks[i].first.x,_blocks[i].first.y,
- _blocks[i].second.x - _blocks[i].first.x,
- _blocks[i].second.y - _blocks[i].first.y,
- FILL_BLACK);
+
+
+ for (int i = 0; i<_number_of_blocks; i++) {
+
+ lcd.drawRect(_blocks[i].first.x,_blocks[i].first.y,
+ _blocks[i].second.x - _blocks[i].first.x,
+ _blocks[i].second.y - _blocks[i].first.y,
+ FILL_BLACK);
}
-
+
+ lcd.drawSprite(_goal.x,_goal.y,11,6,(int *) goalMap);
+
}
\ No newline at end of file