diff --git a/README.md b/README.md index df45d76..313663d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Avoid -

A dumb raylib test +A dumb raylib test which you can play [here](https://canneddonuts.itch.io/avoid-the-game) ## To-do - build guide/better Makefile - fix the dumb bug when the ball gets stuck -- make an HTML5 build diff --git a/build-html5.sh b/build-html5.sh new file mode 100755 index 0000000..ccacebe --- /dev/null +++ b/build-html5.sh @@ -0,0 +1,2 @@ +#!/bin/sh +emcc -o html5/index.html src/Main.c -Os -Wall /usr/local/lib/libraylib.a -I. -I/usr/local/include/raylib.h -L. -L/usr/local/lib/libraylib.a -s USE_GLFW=3 -DPLATFORM_WEB --preload-file assets/sfx/boing.wav --preload-file assets/bgm/01-Slipin-Sunday.ogg --shell-file html5/shell.html diff --git a/html5/Avoid_HTML5.zip b/html5/Avoid_HTML5.zip new file mode 100644 index 0000000..74c7987 Binary files /dev/null and b/html5/Avoid_HTML5.zip differ diff --git a/html5/shell.html b/html5/shell.html new file mode 100644 index 0000000..fe022b1 --- /dev/null +++ b/html5/shell.html @@ -0,0 +1,328 @@ + + + + + + + Avoid: the game + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +
+ +
+ + + + + + + + + + {{{ SCRIPT }}} + + diff --git a/src/Main.c b/src/Main.c index cd411a2..aacd8d0 100644 --- a/src/Main.c +++ b/src/Main.c @@ -1,7 +1,8 @@ -#include "raylib.h" - #if defined(PLATFORM_WEB) + #include "/usr/local/include/raylib.h" #include +#else + #include "raylib.h" #endif // screen variables @@ -16,6 +17,7 @@ typedef struct Ball { Vector2 position; Vector2 speed; float radius; + float growth; Color color; bool active; } Ball; @@ -89,6 +91,7 @@ void GameInit(void) ball.position = (Vector2){ 50, 50 }; ball.radius = 20; + ball.growth = 2; ball.speed = (Vector2){ 400.0f, 400.0f }; ball.color = MAROON; ball.active = true; @@ -163,11 +166,8 @@ void UpdateGame(void) if (CheckCollisionCircleRec(ball.position, ball.radius, player.hitbox)) player.hp--; - if (BallFrameCounter==1000) ball.radius = 40; - if (BallFrameCounter==2000) ball.radius = 50; - if (BallFrameCounter==3000) ball.radius = 60; - if (BallFrameCounter==4000) ball.radius = 70; - if (BallFrameCounter==5000) ball.radius = 80; + + if (BallFrameCounter <= 2500) ball.radius += GetFrameTime() * ball.growth; } if (player.hp <= 0) currentScreen = GAMEOVER;