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:
- 14:d0650d0de063
- Parent:
- 13:c3b550fc2445
- Child:
- 15:a080c64cf301
diff -r c3b550fc2445 -r d0650d0de063 Coin/Coin.cpp
--- a/Coin/Coin.cpp Sat May 04 19:33:08 2019 +0000
+++ b/Coin/Coin.cpp Mon May 06 14:13:09 2019 +0000
@@ -1,7 +1,8 @@
#include "Coin.h"
Coin::Coin(){
-
+ x_coin = 41;
+ y_coin = 42;
}
Coin::~Coin(){
@@ -13,54 +14,34 @@
y_coin = y;
}
-int Coin::get_x_coin()
-{
+int Coin::get_x_coin(){
return x_coin;
}
-int Coin::get_y_coin()
-{
+int Coin::get_y_coin(){
return y_coin;
}
void Coin::drawSprite(N5110 &lcd){
- lcd.drawSprite(x_coin,y_coin,2,2,(int *)coin);
+ lcd.drawSprite(x_coin,y_coin,2,2,(int *)coin_01);
}
-bool Coin::northCollision(int x, int y, N5110 &lcd){
+void Coin::collect(N5110 &lcd){
+
+}
- for (int i = 0; i < 1; i++) {
- if (lcd.getPixel(x + i,y) == 1) {
+bool Coin::topLeftCollision(int x, int y, N5110 &lcd){
+ for (int i = 0; i <= 1; i++){
+ if (lcd.getPixel(x + i,y) == 1){
return true;
}
}
return false;
}
-bool Coin::southCollision(int x, int y, N5110 &lcd){
-
- for (int i = 0; i < 1; 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 < 1; 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 < 1; i++) {
- if (lcd.getPixel(x,y + i) == 1) {
+bool Coin::bottomRightCollision(int x, int y, N5110 &lcd){
+ for (int i = 0; i <= 1; i++){
+ if (lcd.getPixel(x + 1,y + i) == 1){
return true;
}
}