Przeglądaj źródła

slow down player movement

jblanked 10 miesięcy temu
rodzic
commit
66a9d7251a
2 zmienionych plików z 6 dodań i 11 usunięć
  1. 2 7
      game/level.c
  2. 4 4
      game/player.c

+ 2 - 7
game/level.c

@@ -182,16 +182,11 @@ static void level_start(Level *level, GameManager *manager, void *context)
         // furi_delay_ms(1000);
         game_context->is_switching_level = false;
     }
-    /*
-       adjust the player's position n such based on icon count
-       the more icons to draw, the slower the player moves
-       so we'll increase the player's speed as the icon count increases
-       by 0.1 for every 8 icons
-   */
+
     game_context->icon_offset = 0;
     if (!game_context->imu_present)
     {
-        game_context->icon_offset += ((game_context->icon_count / 8) / 10);
+        game_context->icon_offset += ((game_context->icon_count / 10) / 25);
     }
     player_spawn(level, manager);
 }

+ 4 - 4
game/player.c

@@ -256,7 +256,7 @@ static void player_update(Entity *self, GameManager *manager, void *context)
 
         if (!game_context->is_menu_open)
         {
-            pos.y -= (2 + game_context->icon_offset);
+            pos.y -= (1 + game_context->icon_offset);
             player->dy = -1;
             player->direction = ENTITY_UP;
         }
@@ -277,7 +277,7 @@ static void player_update(Entity *self, GameManager *manager, void *context)
 
         if (!game_context->is_menu_open)
         {
-            pos.y += (2 + game_context->icon_offset);
+            pos.y += (1 + game_context->icon_offset);
             player->dy = 1;
             player->direction = ENTITY_DOWN;
         }
@@ -298,7 +298,7 @@ static void player_update(Entity *self, GameManager *manager, void *context)
 
         if (!game_context->is_menu_open)
         {
-            pos.x -= (2 + game_context->icon_offset);
+            pos.x -= (1 + game_context->icon_offset);
             player->dx = -1;
             player->direction = ENTITY_LEFT;
         }
@@ -321,7 +321,7 @@ static void player_update(Entity *self, GameManager *manager, void *context)
 
         if (!game_context->is_menu_open)
         {
-            pos.x += (2 + game_context->icon_offset);
+            pos.x += (1 + game_context->icon_offset);
             player->dx = 1;
             player->direction = ENTITY_RIGHT;
         }