fin mini snake trop fatiguee
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -7,5 +7,6 @@
|
||||
"**/.DS_Store": true,
|
||||
"**/*.o": true,
|
||||
"**/*.exe": true,
|
||||
}
|
||||
},
|
||||
"cmake.sourceDirectory": "/home/mrsh/Games/test-text/build/external/raylib-master"
|
||||
}
|
||||
20
src/main.c
20
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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user