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:
- 2:725c213b2396
- Parent:
- 1:813ba5341985
- Child:
- 3:d27ee2440829
--- a/Minerengine.cpp Tue Mar 19 14:48:40 2019 +0000
+++ b/Minerengine.cpp Wed Mar 20 01:32:31 2019 +0000
@@ -1,7 +1,10 @@
#include "Minerengine.h"
Minerengine::Minerengine()
+
{
+ _x = 0;
+ _y = 33;
}
Minerengine::~Minerengine()
@@ -30,31 +33,33 @@
void Minerengine::miner_jump(N5110 &lcd, Gamepad &pad)
{
if(_d==3 && pad.check_event(Gamepad::A_PRESSED)) {
- for (int i = 0; i < 6; i++){
+ for (int i = 0; i < 6; i++) {
_y = _y -1;
- lcd.drawSprite(WIDTH/2 + _x,HEIGHT/2 + _y,13,5,(int *)miner_right);
-
+ lcd.drawSprite(_x,_y,12,5,(int *)miner_right);
+
}
}
- if(_d==7 && pad.check_event(Gamepad::A_PRESSED))
- {
- for (int i = 0; i < 6; i++)
- {
+ if(_d==7 && pad.check_event(Gamepad::A_PRESSED)) {
+ for (int i = 0; i < 6; i++) {
_y = _y -1;
- lcd.drawSprite(WIDTH/2 + _x,HEIGHT/2 + _y,13,5,(int *)miner_left);
-
+ 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;
+ lcd.drawSprite(_x,_y,12,5,(int *)miner_left);
}
}
}
void Minerengine::miner_draw(N5110 &lcd)
{
- if (_direction == 1)
- {
- lcd.drawSprite(WIDTH/2 + _x,HEIGHT/2 + _y,13,5,(int *)miner_right);
+ if (_direction == 1) {
+ lcd.drawSprite(_x,_y,12,5,(int *)miner_right);
}
- if (_direction == 0)
- {
- lcd.drawSprite(WIDTH/2 + _x,HEIGHT/2 + _y,13,5,(int *)miner_left);
+ if (_direction == 0) {
+ lcd.drawSprite(_x,_y,12,5,(int *)miner_left);
}
}
\ No newline at end of file