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: Gameengine/Gameengine.cpp
- Revision:
- 35:3d4dd92bc82b
- Parent:
- 34:66e37a0d59c3
- Child:
- 36:cdfba51a0a44
diff -r 66e37a0d59c3 -r 3d4dd92bc82b Gameengine/Gameengine.cpp
--- a/Gameengine/Gameengine.cpp Wed Apr 29 13:43:20 2020 +0000
+++ b/Gameengine/Gameengine.cpp Fri May 08 07:49:32 2020 +0000
@@ -71,7 +71,7 @@
}
void Gameengine::check_collision(Gamepad &gamepad) {
- if ((_player_x - _item.get_item_x()) < 5) && ((_player_y - _item.get_item_y()) < 5)) {
+ if ((_player_x == _item.get_item_x() - 5) && (_player_y == _item.get_item_y() - 5)) {
_collision_flag = true;
_player_score++;
_item.set_item(((rand()%80)+ 5) , ((rand()%80)+ 5)); // use the rand()%m function to generate a number from 80 to 1