From 962e15debc913354bbc2994b924b90840a723e8c Mon Sep 17 00:00:00 2001 From: mrsh Date: Mon, 20 Apr 2026 23:42:49 +0200 Subject: [PATCH] fin mini snake trop fatiguee --- .vscode/settings.json | 3 ++- src/main.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e98318a..63797c4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "**/.DS_Store": true, "**/*.o": true, "**/*.exe": true, - } + }, + "cmake.sourceDirectory": "/home/mrsh/Games/test-text/build/external/raylib-master" } \ No newline at end of file diff --git a/src/main.c b/src/main.c index fe07847..e9b5ba2 100644 --- a/src/main.c +++ b/src/main.c @@ -10,7 +10,7 @@ by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit h #include "raylib.h" #include "resource_dir.h" // utility header for SearchAndSetResourceDir -#include +#include int main () { @@ -50,7 +50,7 @@ int main () DrawCircle(HorizontalPosition, VerticalPosition, 10, BLUE); - DrawCircle(positionYCollectible, positionXCollectible, 10, YELLOW); + DrawCircle(positionXCollectible, positionYCollectible, 10, YELLOW); //draw score DrawText(TextFormat("score : %d", point), 500,50,20,PINK); @@ -59,21 +59,21 @@ int main () //up if (IsKeyDown(74) && VerticalPosition != 580 ) { // draw some text using the default font - VerticalPosition = VerticalPosition+1; + VerticalPosition = VerticalPosition+10; }; //down if (IsKeyDown(75) && VerticalPosition != 0) { - VerticalPosition = VerticalPosition-1; + VerticalPosition = VerticalPosition-10; // draw some text using the default font }; //left if (IsKeyDown(72) && HorizontalPosition != 0) { - HorizontalPosition = HorizontalPosition-1; + HorizontalPosition = HorizontalPosition-10; // draw some text using the default font }; //right if (IsKeyDown(76)&& HorizontalPosition != 780) { - HorizontalPosition = HorizontalPosition+1; + HorizontalPosition = HorizontalPosition+10; // draw some text using the default font }; @@ -81,10 +81,10 @@ int main () DrawText("Emi la plus belle", 50,50,20,PINK); } - if((positionXCollectible == VerticalPosition -10 || positionXCollectible == VerticalPosition +10) - && (positionYCollectible == HorizontalPosition -10 || positionYCollectible == HorizontalPosition +10)){ - positionXCollectible = GetRandomValue(0, 600); - positionYCollectible = GetRandomValue(0, 800); + if (abs(positionXCollectible - HorizontalPosition) < 10 && + abs(positionYCollectible - VerticalPosition) < 10){ + positionXCollectible = GetRandomValue(0, 800); + positionYCollectible = GetRandomValue(0, 600); point = point + 1; }