antirez 3 лет назад
Родитель
Сommit
6f7abf0b09
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      app.c

+ 6 - 1
app.c

@@ -535,7 +535,12 @@ void game_tick(void *ctx) {
      * asteroids_update_keypress_state() since depends on exact
      * asteroids_update_keypress_state() since depends on exact
      * pressure timing. */
      * pressure timing. */
     if (app->fire) {
     if (app->fire) {
-        ship_fire_bullet(app);
+        uint32_t bullet_min_period = 200; // In milliseconds
+        uint32_t now = furi_get_tick();
+        if (now - app->last_bullet_tick >= bullet_min_period) {
+            ship_fire_bullet(app);
+            app->last_bullet_tick = now;
+        }
         app->fire = false;
         app->fire = false;
     }
     }