works, not done
This commit is contained in:
parent
b07cee75ce
commit
5be8f91587
2 changed files with 14 additions and 6 deletions
BIN
MyGame
BIN
MyGame
Binary file not shown.
20
main.c
20
main.c
|
|
@ -91,6 +91,12 @@ bool IsPlayerColliding(struct DoublePipe* double_pipe, struct Birdie* bird) {
|
||||||
return CheckCollisionCircleRec(center, bird_radius, rec1) || CheckCollisionCircleRec(center, bird_radius, rec2);
|
return CheckCollisionCircleRec(center, bird_radius, rec1) || CheckCollisionCircleRec(center, bird_radius, rec2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum GameState {
|
||||||
|
Start,
|
||||||
|
Game,
|
||||||
|
Restart
|
||||||
|
};
|
||||||
|
|
||||||
enum GameState MainGame(struct DoublePipe* double_pipe, struct Birdie* bird, int pipe_height, int pipe_gap) {
|
enum GameState MainGame(struct DoublePipe* double_pipe, struct Birdie* bird, int pipe_height, int pipe_gap) {
|
||||||
if (!IsPlayerColliding(double_pipe, bird)) {
|
if (!IsPlayerColliding(double_pipe, bird)) {
|
||||||
ClearBackground(BLACK);
|
ClearBackground(BLACK);
|
||||||
|
|
@ -106,10 +112,8 @@ enum GameState MainGame(struct DoublePipe* double_pipe, struct Birdie* bird, int
|
||||||
return Game;
|
return Game;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GameState {
|
enum GameState StartGame() {
|
||||||
Start,
|
|
||||||
Game,
|
|
||||||
Restart
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
@ -124,11 +128,15 @@ int main(void) {
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
switch (GameState) {
|
switch (gs) {
|
||||||
case Game:
|
case Game:
|
||||||
MainGame(&double_pipe, &bird, pipe_height, pipe_gap);
|
MainGame(&double_pipe, &bird, pipe_height, pipe_gap);
|
||||||
|
break;
|
||||||
case Restart:
|
case Restart:
|
||||||
//func for restart
|
break;
|
||||||
|
case Start:
|
||||||
|
MainGame(&double_pipe, &bird, pipe_height, pipe_gap);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue