From 8030f96ad2c964040349955627e14c844fc8986d Mon Sep 17 00:00:00 2001 From: pack Date: Fri, 7 Aug 2026 18:54:43 +0000 Subject: final commit 2 add LICENSE, edit README.md --- LICENSE | 29 +++++++++++++++ README.md | 65 +++++++++++++++++++++++++++++++++ "mus/mus_r\303\252verie_-_debussy.ogg" | Bin 3948954 -> 0 bytes mus_example.ogg | Bin 0 -> 3948954 bytes screenshot.png | Bin 0 -> 8640 bytes tiny.c | 4 +- 6 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 LICENSE delete mode 100644 "mus/mus_r\303\252verie_-_debussy.ogg" create mode 100644 mus_example.ogg create mode 100644 screenshot.png diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..49c4955 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +Trinity License + +~ 2026 ln + +Redistribution and use in source and and any other forms, with or without +modification, are permitted provided that the following conditions are met: + +Any redistributions, with or without modification to software, or derivative +works in any form must retain the above copyright notice, this list of +conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. + +Any redistributions, with or without modification to software, or derivative +works in any form must include the entire source code. + +Any redistributions, with or without modification to software, or derivative +works in any form must remain gratis and not be sold at any price for any +amount of profit. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index e69de29..ef46feb 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,65 @@ +# prj tiny + +A small first-person sword combat game built with [raylib](https://www.raylib.com/). Fight a single enemy in a starlit arena. Built as a learning/prototype project. + +![screenshot](screenshot.png) + +## ~features + +- **First-person melee combat** — left-click to swing your sword +- **Procedural audio** — sword swings, footsteps, and ambient drone are all generated in code (no audio files needed) +- **Enemy AI** — the enemy auto-attacks on a randomized timer and turns to face you +- **Player death & respawn** — die and you respawn after 2 seconds +- **Title screen + pause menu** — mouse-driven UI with fade transitions +- **Twinkling starfield** — 200 stars with per-star phase animation +- **Streaming background music** — drop in your own `music.ogg` + +## ~controls + +| Action | Input | +|--------|-------| +| Move | WASD | +| Look | Mouse | +| Swing sword | Left click | +| Pause | ESC | +| Start game | Click PLAY or ENTER | + +## ~requirements + +- [raylib](https://github.com/raysan5/raylib) (built with audio + OGG/Vorbis support) +- A C compiler (gcc/clang) +- `music.ogg` (optional — place next to the binary) + +## ~build + +```bash +gcc tiny.c -o tiny -lraylib -lm -lGL -lpthread -ldl -lrt -lvorbisfile -lvorbis -logg +``` + +For a static build (recommended for distribution): + +```bash +gcc tiny.c -o tiny -Wl,-Bstatic -lraylib -lvorbisfile -lvorbis -logg \ + -Wl,-Bdynamic -lGL -lm -lpthread -ldl -lrt +``` + +## ~run + +```bash +./tiny +``` + +> `music.ogg` is loaded relative to your working directory. Place it next to the binary if you want background music. The game runs fine without it. + +## ~how it works + +The game is a single C file (~625 lines) with no external assets except an optional music file: + +- **Graphics:** raylib's 3D immediate-mode API (`DrawCube`, `DrawCylinderEx`, etc.) for the world + sword models, 2D overlay for HUD/menus +- **Audio:** sounds are synthesized at runtime into `Wave` structs and loaded via `LoadSoundFromWave` — no `.wav` files needed +- **Combat:** sword swings are time-based with damage applied at the swing midpoint, gated by a `damage_dealt` flag to prevent multi-hit +- **Camera:** raylib's built-in `CAMERA_FIRST_PERSON` mode + +## ~license + +Trinity License diff --git "a/mus/mus_r\303\252verie_-_debussy.ogg" "b/mus/mus_r\303\252verie_-_debussy.ogg" deleted file mode 100644 index 222c750..0000000 Binary files "a/mus/mus_r\303\252verie_-_debussy.ogg" and /dev/null differ diff --git a/mus_example.ogg b/mus_example.ogg new file mode 100644 index 0000000..222c750 Binary files /dev/null and b/mus_example.ogg differ diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..2270d57 Binary files /dev/null and b/screenshot.png differ diff --git a/tiny.c b/tiny.c index 7e0e866..5293a12 100644 --- a/tiny.c +++ b/tiny.c @@ -390,8 +390,8 @@ main(int argc, char *argv[]) SetSoundVolume(snd_footstep, 0.35f); SetSoundVolume(snd_ambience, 0.3f); /* Background music (your own .ogg file). */ - Music music = LoadMusicStream("mus_rêverie_-_debussy.ogg"); - SetMusicVolume(music, 0.4f); + Music music = LoadMusicStream("mus_example.ogg"); + SetMusicVolume(music, 1.0f); PlayMusicStream(music); /* 3D Camera. */ Camera3D camera = { 0 }; -- cgit v1.2.3