aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arduino_sketch/arcerino/arcerino.ino18
1 files changed, 16 insertions, 2 deletions
diff --git a/arduino_sketch/arcerino/arcerino.ino b/arduino_sketch/arcerino/arcerino.ino
index b2b9c38..7b9662e 100644
--- a/arduino_sketch/arcerino/arcerino.ino
+++ b/arduino_sketch/arcerino/arcerino.ino
@@ -114,6 +114,17 @@ char get_score() {
}
}
+void new_arrow() {
+ arrows = arrows--;
+ drift_x = random(-LCD_MAX/2,LCD_MAX/2) + random(-LCD_MAX/2,LCD_MAX/2);
+ drift_y = random(-LCD_MAX/2,LCD_MAX/2) + random(-LCD_MAX/2,LCD_MAX/2);
+}
+
+void new_round() {
+ arrows = 10;
+ score = 0;
+}
+
void setup() {
nunchuk_init();
u8g.setColorIndex(1);
@@ -124,6 +135,8 @@ void setup() {
draw_title();
} while(u8g.nextPage());
delay(4000);
+ new_arrow();
+ new_round();
}
void loop() {
@@ -132,7 +145,7 @@ void loop() {
if (play) {
if (nunchuk_zbutton()) {
score = score + get_score();
- arrows = arrows--;
+ new_arrow();
u8g.firstPage();
do {
draw_score();
@@ -140,7 +153,6 @@ void loop() {
delay(3000);
if ( arrows <= 0 ) {
play = false;
- arrows = 10;
}
} else {
update_position();
@@ -152,7 +164,9 @@ void loop() {
}
} else {
if (nunchuk_zbutton()) {
+ new_round();
play=true;
+ delay(200);
} else {
u8g.firstPage();
do {