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.
Diff: Gold/Gold.cpp
- Revision:
- 12:07a9f2140d9b
- Parent:
- 10:51870f8e2e1a
- Child:
- 19:08c582bcdc98
diff -r 9da147cd7c18 -r 07a9f2140d9b Gold/Gold.cpp
--- a/Gold/Gold.cpp Mon Apr 27 05:44:02 2020 +0000
+++ b/Gold/Gold.cpp Mon Apr 27 16:02:47 2020 +0000
@@ -15,6 +15,7 @@
_gold_num = gold_num;
_gold_left = _gold_num;
srand(time(NULL));
+ _gold_speed=1;
for (int i=0;i<_gold_num;i++){
_gold_caught[i] = 0;
_gold_reached[i] = 0;
@@ -41,8 +42,8 @@
for (int i=0;i<_gold_num;i++) {
if (_gold_caught[i]==1&&_gold_reached[i]==0) {
- _y[i]-=1;
- if (_y[i]<=14) {
+ _y[i]-=_gold_speed;
+ if (_y[i]<=17) {
_gold_reached[i]=1;
_gold_left--;
}
@@ -85,4 +86,8 @@
_y[i] = p.y;
}
}
+}
+
+void Gold::set_speed(int speed) {
+ _gold_speed = speed;
}
\ No newline at end of file