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:
- 19:1073cc64cb0b
- Parent:
- 18:ba4159ab4da7
- Child:
- 21:7d4827af00d6
--- a/Coin/Coin.cpp Wed May 08 15:01:45 2019 +0000 +++ b/Coin/Coin.cpp Wed May 08 18:12:27 2019 +0000 @@ -32,27 +32,32 @@ bool Coin::collidePlayer(int x, int y, Gamepad &pad) { for (int ix = 0; ix < 7; ix++) { for (int iy = 0; iy < 7; iy++) { - if ( x + ix == x_coin - 1 && + /* if ( x + 3 == x_coin + ix && + y + 3 == y_coin + iy) { + ++coin; + pad.tone(650,0.25); + return true;*/ + if ( x + ix == x_coin - 1 && y + iy == y_coin) { ++coin; pad.tone(650,0.25); - return true; - } else if ( x + ix == x_coin + 2 && + return true; + } else if ( x + ix == x_coin + 2 && y + iy == y_coin) { ++coin; pad.tone(650,0.25); - return true; - } else if ( x + ix == x_coin && + return true; + } else if ( x + ix == x_coin && y + iy == y_coin - 1) { ++coin; pad.tone(650,0.25); - return true; - } else if ( x + ix == x_coin && + return true; + } else if ( x + ix == x_coin && y + iy == y_coin + 2) { ++coin; pad.tone(650,0.25); return true; - } + } } } return false;