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: Coin/Coin.cpp
- Revision:
- 15:a080c64cf301
- Parent:
- 14:d0650d0de063
- Child:
- 16:37d98c281eb3
--- a/Coin/Coin.cpp Mon May 06 14:13:09 2019 +0000
+++ b/Coin/Coin.cpp Mon May 06 18:39:40 2019 +0000
@@ -30,8 +30,8 @@
}
-bool Coin::topLeftCollision(int x, int y, N5110 &lcd){
- for (int i = 0; i <= 1; i++){
+bool Coin::northCollision(int x, int y, N5110 &lcd){
+ for (int i = 0; i < 2; i++){
if (lcd.getPixel(x + i,y) == 1){
return true;
}
@@ -39,11 +39,29 @@
return false;
}
-bool Coin::bottomRightCollision(int x, int y, N5110 &lcd){
- for (int i = 0; i <= 1; i++){
+bool Coin::southCollision(int x, int y, N5110 &lcd){
+ for (int i = 0; i < 2; i++){
+ if (lcd.getPixel(x + i,y + 1) == 1){
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Coin::eastCollision(int x, int y, N5110 &lcd){
+ for (int i = 0; i < 2; i++){
if (lcd.getPixel(x + 1,y + i) == 1){
return true;
}
}
return false;
+}
+
+bool Coin::westCollision(int x, int y, N5110 &lcd){
+ for (int i = 0; i < 2; i++){
+ if (lcd.getPixel(x,y + i) == 1){
+ return true;
+ }
+ }
+ return false;
}
\ No newline at end of file