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: Wall/Wall.cpp
- Revision:
- 9:192ad897ec95
- Parent:
- 8:ccf827ce0072
- Child:
- 10:bb273261d33d
--- a/Wall/Wall.cpp Mon Apr 22 03:37:34 2019 +0000
+++ b/Wall/Wall.cpp Sun Apr 28 21:32:06 2019 +0000
@@ -8,7 +8,7 @@
Date: 11/04/2019
*/
-#include "Walls.h"
+ #include "Wall.h"
Wall::Wall(){
}
@@ -19,30 +19,22 @@
void Wall::init(int size,int speed)
{
_size = size;
- _x = WIDTH;
+ _x =0;
_y =0 ;
- srand(time(NULL));
- int di = 0; // randomise the direction.
- if (di == 0) {
- _velocity.x = speed;
- _velocity.y = 1;
- }
+ _velocity.x = speed;
+ _velocity.y = speed;
}
void Wall::draw(N5110 &lcd)
{
- /* lcd.drawRect(_x+1,_y+1,_x+40,_y+1,FILL_BLACK);
- lcd.drawRect(_x+5,_y+2,_x+36,_y+2,FILL_BLACK);
- lcd.drawRect(_x+10,_y+3,_x+31,_y+3,FILL_BLACK);
- lcd.drawRect(_x+15,_y+4,_x+26,_y+4,FILL_BLACK);
- lcd.drawRect(_x+17,_y+5,_x+23,_y+5,FILL_BLACK);
- lcd.drawRect(_x+19,_y+6,_x+21,_y+6,FILL_BLACK);*/
+ lcd.drawRect(_x,_y,1,_y+10,FILL_BLACK);
- lcd.drawRect(_x,_y,_x+10,_y+10,FILL_BLACK);
- // lcd.drawRect(_x+20,_y,_x+30,_y+10,FILL_BLACK);
- lcd.drawRect(_x+10,_y+33,_x+20,_y+40,FILL_BLACK);
+ /*lcd.drawRect(_x,_y,_x+5,_y+10,FILL_BLACK);
+
+ lcd.drawRect(_x+10,_y+33,_x+15,_y+40,FILL_BLACK);*/
+
}
@@ -52,7 +44,7 @@
_x -= _velocity.x;
if (_x <= 1){
_x = WIDTH;
- _y = 0;
+ _y = _y;
}
}