From c129a617b48e28924fa99c3ca10000d56554509f Mon Sep 17 00:00:00 2001
From: _N3m0 <n3m0o7@hotmail.com>
Date: Mon, 25 Mar 2024 15:59:05 +0100
Subject: [PATCH] refacto

---
 main.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index 6f2eea4..a7256a2 100644
--- a/main.c
+++ b/main.c
@@ -285,9 +285,12 @@ int main(void)
 
             Vec2i player_map = screen_to_map_coord(player);
 
-            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+            if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
                 bullets[bullet_index] = (Bullet) {
-                    .coord = move_forward_angle(Vector2_cast(player_map), angle + 90, player_t.width/2),
+                    .coord = move_forward_angle(
+                        Vector2_cast(player_map),
+                        angle + 90, player_t.width/27
+                    ),
                     .angle = -angle,
                     .lifetime = 5.0f,
                 };
@@ -312,14 +315,21 @@ int main(void)
             }
 
             if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) {
-                DrawLineEx((Vector2){.x = player.x, .y = player.y}, mouse, 5.0f, GOLD);
+                DrawLineEx(
+                    (Vector2){.x = player.x, .y = player.y},
+                    mouse, 5.0f, GOLD
+                );
             }
 
             // player
             DrawTexturePro(
                 player_t,
-                (Rectangle) {0, 0, player_t.width, player_t.height},
-                (Rectangle) {player.x, player.y, player_t.width, player_t.height},
+                (Rectangle) {
+                    0, 0, player_t.width, player_t.height
+                },
+                (Rectangle) {
+                    player.x, player.y, player_t.width, player_t.height
+                },
                 (Vector2) {player_t.width/2, player_t.height/2},
                 450 - angle, WHITE
             );