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: Minerengine.cpp
- Revision:
- 4:b92da6a09c8b
- Parent:
- 3:d27ee2440829
- Child:
- 6:866281ce2b44
diff -r d27ee2440829 -r b92da6a09c8b Minerengine.cpp
--- a/Minerengine.cpp Wed Mar 20 18:32:25 2019 +0000
+++ b/Minerengine.cpp Thu Mar 21 21:29:11 2019 +0000
@@ -19,13 +19,15 @@
void Minerengine::miner_move(N5110 &lcd, Gamepad &pad)
{
+
if (_d==3 && !lcd.getPixel(_x + 5, _y)) {
- _x = _x + 1;
+ _x += 1;
_direction = 1;
}
if (_d==7 && !lcd.getPixel(_x -1, _y)) {
_x = _x - 1;
_direction = 0;
+
}
}
void Minerengine::miner_jump(N5110 &lcd, Gamepad &pad)
@@ -33,9 +35,8 @@
if(_d==3 && pad.check_event(Gamepad::A_PRESSED)) {
for (int i = 0; i < 6; i++) {
_y = _y -1;
- lcd.drawSprite(_x,_y,12,5,(int *)miner_right);
-
- if(lcd.getPixel(_x + 5, _y)){
+
+ if(lcd.getPixel(_x + 5, _y)) {
i = 6;
}
}
@@ -43,19 +44,18 @@
if(_d==7 && pad.check_event(Gamepad::A_PRESSED)) {
for (int i = 0; i < 6; i++) {
_y = _y -1;
- if(lcd.getPixel(_x + 5, _y)){
+
+ if(lcd.getPixel(_x + 5, _y)) {
i = 6;
}
- lcd.drawSprite(_x,_y,12,5,(int *)miner_left);
- }
}
+ }
if(_d==0 && pad.check_event(Gamepad::A_PRESSED)) {
for (int i = 0; i < 6; i++) {
_y = _y -1;
- if(lcd.getPixel(_x + 5, _y)){
+ if(lcd.getPixel(_x + 5, _y)) {
i = 6;
}
- lcd.drawSprite(_x,_y,12,5,(int *)miner_left);
}
}
}
@@ -74,5 +74,5 @@
{
if(!lcd.getPixel(_x, _y + 12)) {
_y = _y + 1;
- }
+ }
}
\ No newline at end of file