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: Levelengine.cpp
- Revision:
- 16:8384e9a480ef
- Parent:
- 15:2bda80896a84
- Child:
- 17:b4079bd0e551
diff -r 2bda80896a84 -r 8384e9a480ef Levelengine.cpp
--- a/Levelengine.cpp Fri Mar 29 19:03:10 2019 +0000
+++ b/Levelengine.cpp Sat Mar 30 02:16:28 2019 +0000
@@ -1,7 +1,7 @@
#include "Levelengine.h"
Levelengine::Levelengine()
-{
+{
}
Levelengine::~Levelengine()
@@ -9,23 +9,55 @@
}
void Levelengine::level_one(N5110 &lcd)
-{
+{
//platforms
-
+
lcd.drawRect(0,HEIGHT -1,84,1,FILL_BLACK);
lcd.drawRect(11,HEIGHT - 9, 38, 2, FILL_TRANSPARENT);
- lcd.drawRect(55,HEIGHT - 11, 30, 2, FILL_TRANSPARENT);
+ lcd.drawRect(65,HEIGHT - 11, 30, 2, FILL_TRANSPARENT);
lcd.drawRect(WIDTH - 9,HEIGHT - 19, 8, 2, FILL_BLACK);
lcd.drawRect(22, 25, 48, 2, FILL_BLACK);
lcd.drawRect(0, 25, 12, 2, FILL_BLACK);
lcd.drawRect(0, 17, 8, 2, FILL_BLACK);
- lcd.drawRect(0, 9, 84, 2, FILL_BLACK);
-
- //solid blocks
-
- lcd.drawSprite(49,37,3,3,(int *)solid_block);
- lcd.drawSprite(52,37,3,3,(int *)solid_block);
- lcd.drawSprite(45,22,3,3,(int *)solid_block);
- lcd.drawSprite(42,22,3,3,(int *)solid_block);
+ lcd.drawRect(0, 9, 27, 2, FILL_BLACK);
+ lcd.drawRect(39, 9, 7, 2, FILL_BLACK);
+ lcd.drawRect(58,9,32,2,FILL_BLACK);
+
+}
+
+void Levelengine::soft_blocks(int x, int y, N5110 &lcd)
+{
+ if((lcd.getPixel(x,y))||(lcd.getPixel(x+1,y))||(lcd.getPixel(x+2,y))
+ ||(lcd.getPixel(x+3,y))||(lcd.getPixel(x+4,y))||(lcd.getPixel(x+5,8)) == 1) {
+ lcd.drawRect(x,y+1,6,1,FILL_WHITE);
+ printf("pixel = %i \n", lcd.getPixel(x,y));
+ } else {
+ lcd.drawRect(x,y+1,6,1,FILL_BLACK);
+ }
}
+void Levelengine::draw_solid_block(int x, int y, N5110 &lcd)
+{
+ lcd.drawSprite(x,y,3,3,(int *)solid_block);
+ lcd.drawSprite(x,y,3,3,(int *)solid_block);
+
+}
+
+void Levelengine::draw_key(int x, int y, N5110 &lcd)
+{
+ printf(" k = %i \n", _k);
+
+ if(lcd.getPixel(x+2,y+3) == 0 && _k == 0) {
+ lcd.drawSprite(x,y,3,4,(int *)key);
+ }
+ if(_k==1) {
+ for(int i = 0; i < 4; i++) {
+
+ lcd.setPixel(x+i, y, false);
+ lcd.setPixel(x+i, y+1, false);
+ lcd.setPixel(x+i, y+2, false);
+ }
+ }
+}
+
+