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
Fork of el17zl by
Diff: Ppl/Ppl.cpp
- Revision:
- 13:5930f0e5889d
- Parent:
- 8:83891ea9a5d9
--- a/Ppl/Ppl.cpp Sun Apr 28 17:56:09 2019 +0000
+++ b/Ppl/Ppl.cpp Tue Apr 30 09:58:30 2019 +0000
@@ -34,7 +34,7 @@
lcd.drawSprite(_x,_y,8,8,(int *)ppl);
}
-void Ppl::update(int bb,int ba,int bx,int by,int temp,
+void Ppl::update(int bb,int ba,int bx,int by,int indicator,
int barrier_x,int barrier_y)
{
int temp_x = _x;
@@ -51,7 +51,7 @@
}
hold_ppl_against_wall();
- hold_ppl_box_touching(temp);
+ hold_ppl_box_touching(indicator);
}
@@ -69,8 +69,7 @@
bool Ppl::hold_beside_barrier(int barrier_x,int barrier_y) // check after moving if ppl pos match the barrier
{
- // if matched return ture
-
+ // if matched barrier return ture
if (_x == barrier_x &&_y == barrier_y) {
return true;
} else {
@@ -103,18 +102,21 @@
}
}
-void Ppl::hold_ppl_box_touching(int temp) //check for box facing wall and hold pos of ppl
+void Ppl::hold_ppl_box_touching(int indicator) //check for box facing wall and hold pos of ppl
+// 0: do nothing
+// 1: next move box off the left hold ppl in x = 10; 2: next move box off the right hold ppl in x = 66;
+// 3: next move box off the top hold ppl in y = 12; 4: next move box off the bottom hold ppl in y = 28;
{
- if (temp == 0 ) {
+ if (indicator == 0 ) {
_y = _y;
_x = _x;
- } else if (temp == 1 && _x <=10) {
+ } else if (indicator == 1 && _x <=10) {
_x = 10;
- } else if (temp == 2 && _x >=66) {
+ } else if (indicator == 2 && _x >=66) {
_x = 66;
- } else if (temp == 3 && _y <=12 ) {
+ } else if (indicator == 3 && _y <=12 ) {
_y = 12;
- } else if (temp == 4 && _y >=28) {
+ } else if (indicator == 4 && _y >=28) {
_y = 28;
}
}
