commit f4b4a773f379794793d930536c222dcedbe069c9 Author: Ratdoku Builder Date: Wed Dec 2 10:31:42 2026 -0600 v0.1.0-alpha: first playable 20 rooms, Crumb board token, Home and Game screens only. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40c43c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Godot +.godot/ +*.import + +# Build outputs +build/ +*.apk + +# Local/dev leftovers +screenshots/ + +# Source art and generation workflows +art/guests/source/ +tools/workflows/*/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..404d09f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable alpha milestones for Ratdoku. + +## v0.1.0-alpha — First playable + +- 20 verified 8×8 rooms. +- Core Home and Game screens: board, timer, undo, restart, hint, win overlay. +- Crumb head token shared by every rat on the board. +- Progress and settings saved to `user://ratdoku_save.json`. +- No Guest Book, Settings, or House Rules screens yet. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ef1eb8 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# Ratdoku — v0.1.0-alpha "First playable" + +A cozy rat-hotel logic puzzle. Every guest gets a room, a floor, a corridor, and a little space from the neighbours. + +This is the reconstructed first playable alpha: **20 rooms**, the Crumb head token on the board, and the core Home → Game loop. The Guest Book, Settings, and House Rules screens did not exist yet. + +## Run it + +1. Install **Godot 4.7 or newer** (standard edition, not .NET). +2. Open this folder in Godot (`project.godot`). +3. Press **F5**. + +The project uses a portrait 720×1280 canvas, scaled to a 540×960 desktop window. + +## How to play + +- **Tap / left-click** a cell to mark it with an X. Tap an X or a guest to clear it. +- **Press and hold** (mobile) or **right-click** (PC) to check a guest in. +- **Undo**, **Restart**, and **Hint** are at the bottom. +- A **gold ring** around a guest means they are already checked in and cannot be moved. +- Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally. +- **No guessing is required.** Every room has exactly one solution. + +Every rat uses Crumb's head token in this alpha; per-room guest tokens arrived with the Guest Book. + +## Levels + +`data/levels.json` contains **20 verified 8×8 puzzles**, each starting with three gold-ringed guests. + +## Project layout + +``` +scenes/ + Main.tscn entry point + screen navigation + Home.tscn title screen + Game.tscn board screen + HUD + win overlay + Board.tscn custom-drawn board +scripts/ + Main.gd navigation/back stack + Home.gd home screen + Game.gd level flow, timer, win overlay + Board.gd drawing, input, undo, hints + Rules.gd pure win/conflict rules + Levels.gd JSON level loader + Guests.gd guest manifest loader + SaveGame.gd autoload: settings + progress + Palette.gd colours + UI.gd button/label/panel helpers + RatPortrait.gd fallback vector mascot +art/ + crumb.png, crumb_head.png + guests/{cards,thumbs,heads}/.png +data/ + levels.json 20 verified 8×8 puzzles + guests.json 25 guest entries + tutorial.json 5×5 practice puzzle +``` + +## Save data + +`user://ratdoku_save.json` stores completed rooms, `last_room`, and settings. + +## Android APK + +`build/Ratdoku-v0.1.0-alpha.apk` is a debug-signed, arm64-v8a build: + +- Package: `com.ratdoku.game` +- Version: `0.1.0` (version code 1) +- Portrait orientation diff --git a/art/crumb.png b/art/crumb.png new file mode 100644 index 0000000..a3d8fce Binary files /dev/null and b/art/crumb.png differ diff --git a/art/crumb_head.png b/art/crumb_head.png new file mode 100644 index 0000000..71694f6 Binary files /dev/null and b/art/crumb_head.png differ diff --git a/art/guests/cards/basil.png b/art/guests/cards/basil.png new file mode 100644 index 0000000..7ed37ee Binary files /dev/null and b/art/guests/cards/basil.png differ diff --git a/art/guests/cards/biscuit.png b/art/guests/cards/biscuit.png new file mode 100644 index 0000000..aaf510a Binary files /dev/null and b/art/guests/cards/biscuit.png differ diff --git a/art/guests/cards/brie.png b/art/guests/cards/brie.png new file mode 100644 index 0000000..ab66a3c Binary files /dev/null and b/art/guests/cards/brie.png differ diff --git a/art/guests/cards/clover.png b/art/guests/cards/clover.png new file mode 100644 index 0000000..88ffc1d Binary files /dev/null and b/art/guests/cards/clover.png differ diff --git a/art/guests/cards/cocoa.png b/art/guests/cards/cocoa.png new file mode 100644 index 0000000..072bc2d Binary files /dev/null and b/art/guests/cards/cocoa.png differ diff --git a/art/guests/cards/crumpet.png b/art/guests/cards/crumpet.png new file mode 100644 index 0000000..369249f Binary files /dev/null and b/art/guests/cards/crumpet.png differ diff --git a/art/guests/cards/hilde.png b/art/guests/cards/hilde.png new file mode 100644 index 0000000..1268f1d Binary files /dev/null and b/art/guests/cards/hilde.png differ diff --git a/art/guests/cards/juniper.png b/art/guests/cards/juniper.png new file mode 100644 index 0000000..bc51379 Binary files /dev/null and b/art/guests/cards/juniper.png differ diff --git a/art/guests/cards/mabel.png b/art/guests/cards/mabel.png new file mode 100644 index 0000000..3158245 Binary files /dev/null and b/art/guests/cards/mabel.png differ diff --git a/art/guests/cards/marmalade.png b/art/guests/cards/marmalade.png new file mode 100644 index 0000000..088ba34 Binary files /dev/null and b/art/guests/cards/marmalade.png differ diff --git a/art/guests/cards/marzipan.png b/art/guests/cards/marzipan.png new file mode 100644 index 0000000..e9f7937 Binary files /dev/null and b/art/guests/cards/marzipan.png differ diff --git a/art/guests/cards/miso.png b/art/guests/cards/miso.png new file mode 100644 index 0000000..739121e Binary files /dev/null and b/art/guests/cards/miso.png differ diff --git a/art/guests/cards/mochi.png b/art/guests/cards/mochi.png new file mode 100644 index 0000000..f06392d Binary files /dev/null and b/art/guests/cards/mochi.png differ diff --git a/art/guests/cards/nana_fig.png b/art/guests/cards/nana_fig.png new file mode 100644 index 0000000..a4a5e9e Binary files /dev/null and b/art/guests/cards/nana_fig.png differ diff --git a/art/guests/cards/nib.png b/art/guests/cards/nib.png new file mode 100644 index 0000000..e939589 Binary files /dev/null and b/art/guests/cards/nib.png differ diff --git a/art/guests/cards/nutmeg.png b/art/guests/cards/nutmeg.png new file mode 100644 index 0000000..b3d6ddf Binary files /dev/null and b/art/guests/cards/nutmeg.png differ diff --git a/art/guests/cards/olive.png b/art/guests/cards/olive.png new file mode 100644 index 0000000..3d86a22 Binary files /dev/null and b/art/guests/cards/olive.png differ diff --git a/art/guests/cards/pepper.png b/art/guests/cards/pepper.png new file mode 100644 index 0000000..9d35c66 Binary files /dev/null and b/art/guests/cards/pepper.png differ diff --git a/art/guests/cards/pickle.png b/art/guests/cards/pickle.png new file mode 100644 index 0000000..08fc128 Binary files /dev/null and b/art/guests/cards/pickle.png differ diff --git a/art/guests/cards/pip.png b/art/guests/cards/pip.png new file mode 100644 index 0000000..0b36f52 Binary files /dev/null and b/art/guests/cards/pip.png differ diff --git a/art/guests/cards/poppy.png b/art/guests/cards/poppy.png new file mode 100644 index 0000000..520eae3 Binary files /dev/null and b/art/guests/cards/poppy.png differ diff --git a/art/guests/cards/pumpernickel.png b/art/guests/cards/pumpernickel.png new file mode 100644 index 0000000..0bb28cf Binary files /dev/null and b/art/guests/cards/pumpernickel.png differ diff --git a/art/guests/cards/squeak.png b/art/guests/cards/squeak.png new file mode 100644 index 0000000..051cb63 Binary files /dev/null and b/art/guests/cards/squeak.png differ diff --git a/art/guests/cards/tofu.png b/art/guests/cards/tofu.png new file mode 100644 index 0000000..7444680 Binary files /dev/null and b/art/guests/cards/tofu.png differ diff --git a/art/guests/cards/waffle.png b/art/guests/cards/waffle.png new file mode 100644 index 0000000..f4d3a59 Binary files /dev/null and b/art/guests/cards/waffle.png differ diff --git a/art/guests/heads/basil.png b/art/guests/heads/basil.png new file mode 100644 index 0000000..80fb527 Binary files /dev/null and b/art/guests/heads/basil.png differ diff --git a/art/guests/heads/biscuit.png b/art/guests/heads/biscuit.png new file mode 100644 index 0000000..727de2f Binary files /dev/null and b/art/guests/heads/biscuit.png differ diff --git a/art/guests/heads/brie.png b/art/guests/heads/brie.png new file mode 100644 index 0000000..6680bdd Binary files /dev/null and b/art/guests/heads/brie.png differ diff --git a/art/guests/heads/clover.png b/art/guests/heads/clover.png new file mode 100644 index 0000000..728cd35 Binary files /dev/null and b/art/guests/heads/clover.png differ diff --git a/art/guests/heads/cocoa.png b/art/guests/heads/cocoa.png new file mode 100644 index 0000000..f1e7f0b Binary files /dev/null and b/art/guests/heads/cocoa.png differ diff --git a/art/guests/heads/crumpet.png b/art/guests/heads/crumpet.png new file mode 100644 index 0000000..a1abeff Binary files /dev/null and b/art/guests/heads/crumpet.png differ diff --git a/art/guests/heads/hilde.png b/art/guests/heads/hilde.png new file mode 100644 index 0000000..97a9a79 Binary files /dev/null and b/art/guests/heads/hilde.png differ diff --git a/art/guests/heads/juniper.png b/art/guests/heads/juniper.png new file mode 100644 index 0000000..47eec18 Binary files /dev/null and b/art/guests/heads/juniper.png differ diff --git a/art/guests/heads/mabel.png b/art/guests/heads/mabel.png new file mode 100644 index 0000000..f2e22b3 Binary files /dev/null and b/art/guests/heads/mabel.png differ diff --git a/art/guests/heads/marmalade.png b/art/guests/heads/marmalade.png new file mode 100644 index 0000000..0a1f135 Binary files /dev/null and b/art/guests/heads/marmalade.png differ diff --git a/art/guests/heads/marzipan.png b/art/guests/heads/marzipan.png new file mode 100644 index 0000000..0f1f72a Binary files /dev/null and b/art/guests/heads/marzipan.png differ diff --git a/art/guests/heads/miso.png b/art/guests/heads/miso.png new file mode 100644 index 0000000..fb2d5bf Binary files /dev/null and b/art/guests/heads/miso.png differ diff --git a/art/guests/heads/mochi.png b/art/guests/heads/mochi.png new file mode 100644 index 0000000..d1529dc Binary files /dev/null and b/art/guests/heads/mochi.png differ diff --git a/art/guests/heads/nana_fig.png b/art/guests/heads/nana_fig.png new file mode 100644 index 0000000..10eb688 Binary files /dev/null and b/art/guests/heads/nana_fig.png differ diff --git a/art/guests/heads/nib.png b/art/guests/heads/nib.png new file mode 100644 index 0000000..576d435 Binary files /dev/null and b/art/guests/heads/nib.png differ diff --git a/art/guests/heads/nutmeg.png b/art/guests/heads/nutmeg.png new file mode 100644 index 0000000..8b8399c Binary files /dev/null and b/art/guests/heads/nutmeg.png differ diff --git a/art/guests/heads/olive.png b/art/guests/heads/olive.png new file mode 100644 index 0000000..763c758 Binary files /dev/null and b/art/guests/heads/olive.png differ diff --git a/art/guests/heads/pepper.png b/art/guests/heads/pepper.png new file mode 100644 index 0000000..bb2f1ea Binary files /dev/null and b/art/guests/heads/pepper.png differ diff --git a/art/guests/heads/pickle.png b/art/guests/heads/pickle.png new file mode 100644 index 0000000..15046d8 Binary files /dev/null and b/art/guests/heads/pickle.png differ diff --git a/art/guests/heads/pip.png b/art/guests/heads/pip.png new file mode 100644 index 0000000..aa28d95 Binary files /dev/null and b/art/guests/heads/pip.png differ diff --git a/art/guests/heads/poppy.png b/art/guests/heads/poppy.png new file mode 100644 index 0000000..1ddc363 Binary files /dev/null and b/art/guests/heads/poppy.png differ diff --git a/art/guests/heads/pumpernickel.png b/art/guests/heads/pumpernickel.png new file mode 100644 index 0000000..c19ff13 Binary files /dev/null and b/art/guests/heads/pumpernickel.png differ diff --git a/art/guests/heads/squeak.png b/art/guests/heads/squeak.png new file mode 100644 index 0000000..621479e Binary files /dev/null and b/art/guests/heads/squeak.png differ diff --git a/art/guests/heads/tofu.png b/art/guests/heads/tofu.png new file mode 100644 index 0000000..2245952 Binary files /dev/null and b/art/guests/heads/tofu.png differ diff --git a/art/guests/heads/waffle.png b/art/guests/heads/waffle.png new file mode 100644 index 0000000..c096d39 Binary files /dev/null and b/art/guests/heads/waffle.png differ diff --git a/art/guests/thumbs/basil.png b/art/guests/thumbs/basil.png new file mode 100644 index 0000000..ced8ac1 Binary files /dev/null and b/art/guests/thumbs/basil.png differ diff --git a/art/guests/thumbs/biscuit.png b/art/guests/thumbs/biscuit.png new file mode 100644 index 0000000..4e617a7 Binary files /dev/null and b/art/guests/thumbs/biscuit.png differ diff --git a/art/guests/thumbs/brie.png b/art/guests/thumbs/brie.png new file mode 100644 index 0000000..68ac162 Binary files /dev/null and b/art/guests/thumbs/brie.png differ diff --git a/art/guests/thumbs/clover.png b/art/guests/thumbs/clover.png new file mode 100644 index 0000000..36115ad Binary files /dev/null and b/art/guests/thumbs/clover.png differ diff --git a/art/guests/thumbs/cocoa.png b/art/guests/thumbs/cocoa.png new file mode 100644 index 0000000..dc428db Binary files /dev/null and b/art/guests/thumbs/cocoa.png differ diff --git a/art/guests/thumbs/crumpet.png b/art/guests/thumbs/crumpet.png new file mode 100644 index 0000000..2e0fccc Binary files /dev/null and b/art/guests/thumbs/crumpet.png differ diff --git a/art/guests/thumbs/hilde.png b/art/guests/thumbs/hilde.png new file mode 100644 index 0000000..cb6d3bb Binary files /dev/null and b/art/guests/thumbs/hilde.png differ diff --git a/art/guests/thumbs/juniper.png b/art/guests/thumbs/juniper.png new file mode 100644 index 0000000..ccbf0c9 Binary files /dev/null and b/art/guests/thumbs/juniper.png differ diff --git a/art/guests/thumbs/mabel.png b/art/guests/thumbs/mabel.png new file mode 100644 index 0000000..227ceaa Binary files /dev/null and b/art/guests/thumbs/mabel.png differ diff --git a/art/guests/thumbs/marmalade.png b/art/guests/thumbs/marmalade.png new file mode 100644 index 0000000..4bdce28 Binary files /dev/null and b/art/guests/thumbs/marmalade.png differ diff --git a/art/guests/thumbs/marzipan.png b/art/guests/thumbs/marzipan.png new file mode 100644 index 0000000..2bb87da Binary files /dev/null and b/art/guests/thumbs/marzipan.png differ diff --git a/art/guests/thumbs/miso.png b/art/guests/thumbs/miso.png new file mode 100644 index 0000000..93d98da Binary files /dev/null and b/art/guests/thumbs/miso.png differ diff --git a/art/guests/thumbs/mochi.png b/art/guests/thumbs/mochi.png new file mode 100644 index 0000000..2cbfe02 Binary files /dev/null and b/art/guests/thumbs/mochi.png differ diff --git a/art/guests/thumbs/nana_fig.png b/art/guests/thumbs/nana_fig.png new file mode 100644 index 0000000..2dc0c76 Binary files /dev/null and b/art/guests/thumbs/nana_fig.png differ diff --git a/art/guests/thumbs/nib.png b/art/guests/thumbs/nib.png new file mode 100644 index 0000000..54fbb54 Binary files /dev/null and b/art/guests/thumbs/nib.png differ diff --git a/art/guests/thumbs/nutmeg.png b/art/guests/thumbs/nutmeg.png new file mode 100644 index 0000000..a6f7e6c Binary files /dev/null and b/art/guests/thumbs/nutmeg.png differ diff --git a/art/guests/thumbs/olive.png b/art/guests/thumbs/olive.png new file mode 100644 index 0000000..4ae3c8c Binary files /dev/null and b/art/guests/thumbs/olive.png differ diff --git a/art/guests/thumbs/pepper.png b/art/guests/thumbs/pepper.png new file mode 100644 index 0000000..0d11ff5 Binary files /dev/null and b/art/guests/thumbs/pepper.png differ diff --git a/art/guests/thumbs/pickle.png b/art/guests/thumbs/pickle.png new file mode 100644 index 0000000..3f45020 Binary files /dev/null and b/art/guests/thumbs/pickle.png differ diff --git a/art/guests/thumbs/pip.png b/art/guests/thumbs/pip.png new file mode 100644 index 0000000..1a03b35 Binary files /dev/null and b/art/guests/thumbs/pip.png differ diff --git a/art/guests/thumbs/poppy.png b/art/guests/thumbs/poppy.png new file mode 100644 index 0000000..2d12fdf Binary files /dev/null and b/art/guests/thumbs/poppy.png differ diff --git a/art/guests/thumbs/pumpernickel.png b/art/guests/thumbs/pumpernickel.png new file mode 100644 index 0000000..e4c8487 Binary files /dev/null and b/art/guests/thumbs/pumpernickel.png differ diff --git a/art/guests/thumbs/squeak.png b/art/guests/thumbs/squeak.png new file mode 100644 index 0000000..37c0de7 Binary files /dev/null and b/art/guests/thumbs/squeak.png differ diff --git a/art/guests/thumbs/tofu.png b/art/guests/thumbs/tofu.png new file mode 100644 index 0000000..125959c Binary files /dev/null and b/art/guests/thumbs/tofu.png differ diff --git a/art/guests/thumbs/waffle.png b/art/guests/thumbs/waffle.png new file mode 100644 index 0000000..18366bb Binary files /dev/null and b/art/guests/thumbs/waffle.png differ diff --git a/data/guests.json b/data/guests.json new file mode 100644 index 0000000..bf72dd5 --- /dev/null +++ b/data/guests.json @@ -0,0 +1,302 @@ +[ + { + "id": "miso", + "name": "Miso", + "role": "Bellhop", + "variety": "Rex", + "coat": "champagne", + "pronouns": "he/him", + "personality": "Eager, a little clumsy, and knows every suitcase by name.", + "snack": "toasted sesame", + "unlock_room": 0, + "accent": "#b46a5a" + }, + { + "id": "hilde", + "name": "Hilde", + "role": "Housekeeper", + "variety": "Sphynx", + "coat": "cream", + "pronouns": "she/her", + "personality": "Deadpan, unflappable, and secretly the kindest rat in the hotel.", + "snack": "warm oat milk", + "unlock_room": 0, + "accent": "#c9a227" + }, + { + "id": "pip", + "name": "Pip", + "role": "Porter", + "variety": "Standard", + "coat": "agouti", + "pronouns": "he/him", + "personality": "Small, bold, and convinced he can carry anything twice his size.", + "snack": "pumpkin seed", + "unlock_room": 0, + "accent": "#8a6f4d" + }, + { + "id": "nana_fig", + "name": "Nana Fig", + "role": "Front desk", + "variety": "Agouti", + "coat": "silvered", + "pronouns": "she/her", + "personality": "Has run the front desk since before the hotel had a front door.", + "snack": "fig jam", + "unlock_room": 0, + "accent": "#7d6b8a" + }, + { + "id": "biscuit", + "name": "Biscuit", + "role": "Pastry chef", + "variety": "Dumbo", + "coat": "cream", + "pronouns": "she/her", + "personality": "Believes every problem can be solved with a warm roll.", + "snack": "buttered toast", + "unlock_room": 0, + "accent": "#d9a441" + }, + { + "id": "pepper", + "name": "Pepper", + "role": "Night watchman", + "variety": "Berkshire", + "coat": "charcoal", + "pronouns": "he/him", + "personality": "Patrols the halls with a lantern and a very serious expression.", + "snack": "black pepper crackers", + "unlock_room": 1, + "accent": "#4f5d75" + }, + { + "id": "pickle", + "name": "Pickle", + "role": "Gardener", + "variety": "Rex", + "coat": "fawn", + "pronouns": "he/him", + "personality": "Grows herbs on the roof and talks to the parsley.", + "snack": "pickled cucumber", + "unlock_room": 2, + "accent": "#7e9c5a" + }, + { + "id": "nutmeg", + "name": "Nutmeg", + "role": "Tea server", + "variety": "Hooded", + "coat": "fawn", + "pronouns": "she/her", + "personality": "Can tell your mood from how you take your tea.", + "snack": "nutmeg biscuit", + "unlock_room": 3, + "accent": "#b07d4f" + }, + { + "id": "mabel", + "name": "Mabel", + "role": "Librarian", + "variety": "Hooded", + "coat": "blue", + "pronouns": "she/her", + "personality": "Runs the hotel library and shushes only when absolutely necessary.", + "snack": "honey candy", + "unlock_room": 4, + "accent": "#5b7fa6" + }, + { + "id": "mochi", + "name": "Mochi", + "role": "Musician", + "variety": "Dumbo", + "coat": "white", + "pronouns": "he/him", + "personality": "Plays the tiny violin in the lobby at dusk.", + "snack": "sweet rice cake", + "unlock_room": 5, + "accent": "#c05b6b" + }, + { + "id": "crumpet", + "name": "Crumpet", + "role": "Baker", + "variety": "Standard", + "coat": "cinnamon", + "pronouns": "he/him", + "personality": "Up before the sun, flour on his nose by sunrise.", + "snack": "warm crumpet", + "unlock_room": 6, + "accent": "#b57a4a" + }, + { + "id": "waffle", + "name": "Waffle", + "role": "Valet", + "variety": "Satin", + "coat": "caramel", + "pronouns": "he/him", + "personality": "Presses a perfect crease and never comments on the mess.", + "snack": "maple candy", + "unlock_room": 7, + "accent": "#c78f52" + }, + { + "id": "cocoa", + "name": "Cocoa", + "role": "Laundress", + "variety": "Mink", + "coat": "mink", + "pronouns": "she/her", + "personality": "Makes the linens smell like a quiet Sunday morning.", + "snack": "dark chocolate", + "unlock_room": 8, + "accent": "#6f5a4d" + }, + { + "id": "olive", + "name": "Olive", + "role": "Concierge", + "variety": "Lilac", + "coat": "lilac", + "pronouns": "she/her", + "personality": "Knows a good route to anywhere, and three better ones.", + "snack": "olive tapenade", + "unlock_room": 9, + "accent": "#7a6b9a" + }, + { + "id": "brie", + "name": "Brie", + "role": "Food critic", + "variety": "Pearl", + "coat": "pearl", + "pronouns": "she/her", + "personality": "Reviews the breakfast with one raised eyebrow.", + "snack": "soft cheese", + "unlock_room": 10, + "accent": "#b8a27a" + }, + { + "id": "basil", + "name": "Basil", + "role": "Herbalist", + "variety": "Rex", + "coat": "sage", + "pronouns": "he/him", + "personality": "Mixes remedies for homesickness and hiccups.", + "snack": "fresh basil", + "unlock_room": 11, + "accent": "#6f8f6a" + }, + { + "id": "juniper", + "name": "Juniper", + "role": "Fortune teller", + "variety": "Dumbo", + "coat": "gray", + "pronouns": "she/her", + "personality": "Reads tea leaves, tarot cards, and the occasional receipt.", + "snack": "juniper berry", + "unlock_room": 12, + "accent": "#6b5d7a" + }, + { + "id": "tofu", + "name": "Tofu", + "role": "Shy traveler", + "variety": "Albino", + "coat": "white", + "pronouns": "he/him", + "personality": "Checks in late, tips well, and hides in the scarf.", + "snack": "plain rice", + "unlock_room": 13, + "accent": "#c9b79c" + }, + { + "id": "squeak", + "name": "Squeak", + "role": "Shoeshine", + "variety": "Standard", + "coat": "brown", + "pronouns": "he/him", + "personality": "Can make a pair of boots look brand new in four minutes.", + "snack": "cheese rind", + "unlock_room": 14, + "accent": "#8a6448" + }, + { + "id": "nib", + "name": "Nib", + "role": "Clerk", + "variety": "Hooded", + "coat": "black and white", + "pronouns": "he/him", + "personality": "Keeps the ledger, the keys, and everyone's secrets.", + "snack": "ink-black tea", + "unlock_room": 15, + "accent": "#5f6b5a" + }, + { + "id": "pumpernickel", + "name": "Pumpernickel", + "role": "Night baker", + "variety": "Berkshire", + "coat": "dark brown", + "pronouns": "he/him", + "personality": "Bakes the bread that wakes the hotel.", + "snack": "dark rye", + "unlock_room": 16, + "accent": "#5d4a3a" + }, + { + "id": "marzipan", + "name": "Marzipan", + "role": "Wedding planner", + "variety": "Satin", + "coat": "cream", + "pronouns": "she/her", + "personality": "Has planned nine weddings and cried at all of them.", + "snack": "almond candy", + "unlock_room": 17, + "accent": "#d4a7a0" + }, + { + "id": "poppy", + "name": "Poppy", + "role": "Bellhop", + "variety": "Dumbo", + "coat": "fawn", + "pronouns": "she/her", + "personality": "The fastest key-runner on the night shift.", + "snack": "poppy-seed cake", + "unlock_room": 18, + "accent": "#b65d5d" + }, + { + "id": "clover", + "name": "Clover", + "role": "Lucky guest", + "variety": "Berkshire", + "coat": "white blaze", + "pronouns": "he/him", + "personality": "Found a four-leaf clover in the lobby and never left.", + "snack": "green apple", + "unlock_room": 19, + "accent": "#6f9a5a" + }, + { + "id": "marmalade", + "name": "Marmalade", + "role": "Breakfast host", + "variety": "Agouti", + "coat": "orange", + "pronouns": "he/him", + "personality": "Knows exactly how you like your toast.", + "snack": "orange marmalade", + "unlock_room": 20, + "accent": "#d08a3e" + } +] diff --git a/data/levels.json b/data/levels.json new file mode 100644 index 0000000..c9a0502 --- /dev/null +++ b/data/levels.json @@ -0,0 +1,2202 @@ +[ + { + "clues": [ + [ + 2, + 7 + ], + [ + 3, + 2 + ], + [ + 7, + 3 + ] + ], + "id": "room-01", + "n": 8, + "regions": [ + [ + 4, + 1, + 1, + 1, + 1, + 0, + 0, + 0 + ], + [ + 4, + 1, + 1, + 1, + 1, + 0, + 0, + 0 + ], + [ + 4, + 4, + 1, + 3, + 3, + 2, + 2, + 2 + ], + [ + 4, + 4, + 3, + 3, + 3, + 2, + 2, + 2 + ], + [ + 4, + 4, + 3, + 7, + 5, + 5, + 5, + 2 + ], + [ + 4, + 6, + 3, + 7, + 7, + 5, + 2, + 2 + ], + [ + 6, + 6, + 7, + 7, + 7, + 5, + 5, + 5 + ], + [ + 6, + 6, + 6, + 7, + 7, + 5, + 5, + 5 + ] + ], + "solution": [ + 6, + 4, + 7, + 2, + 0, + 5, + 1, + 3 + ] + }, + { + "clues": [ + [ + 1, + 3 + ], + [ + 2, + 1 + ], + [ + 4, + 7 + ] + ], + "id": "room-02", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1 + ], + [ + 2, + 2, + 0, + 1, + 1, + 3, + 4, + 4 + ], + [ + 2, + 2, + 0, + 1, + 1, + 3, + 4, + 4 + ], + [ + 2, + 2, + 2, + 1, + 3, + 3, + 4, + 4 + ], + [ + 2, + 5, + 5, + 5, + 3, + 3, + 4, + 4 + ], + [ + 2, + 5, + 5, + 5, + 3, + 3, + 7, + 4 + ], + [ + 5, + 5, + 6, + 6, + 6, + 7, + 7, + 4 + ], + [ + 6, + 6, + 6, + 6, + 7, + 7, + 7, + 7 + ] + ], + "solution": [ + 0, + 3, + 1, + 5, + 7, + 2, + 4, + 6 + ] + }, + { + "clues": [ + [ + 0, + 4 + ], + [ + 2, + 5 + ], + [ + 7, + 2 + ] + ], + "id": "room-03", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1 + ], + [ + 0, + 0, + 3, + 0, + 0, + 2, + 2, + 1 + ], + [ + 4, + 4, + 3, + 0, + 3, + 2, + 2, + 1 + ], + [ + 4, + 4, + 3, + 3, + 3, + 2, + 1, + 1 + ], + [ + 4, + 4, + 4, + 4, + 3, + 2, + 2, + 1 + ], + [ + 6, + 6, + 4, + 3, + 3, + 5, + 5, + 5 + ], + [ + 6, + 7, + 7, + 7, + 5, + 5, + 5, + 5 + ], + [ + 6, + 7, + 7, + 7, + 7, + 7, + 5, + 5 + ] + ], + "solution": [ + 4, + 7, + 5, + 3, + 1, + 6, + 0, + 2 + ] + }, + { + "clues": [ + [ + 0, + 2 + ], + [ + 2, + 0 + ], + [ + 5, + 3 + ] + ], + "id": "room-04", + "n": 8, + "regions": [ + [ + 2, + 0, + 0, + 0, + 1, + 1, + 1, + 3 + ], + [ + 2, + 2, + 0, + 0, + 1, + 1, + 1, + 3 + ], + [ + 2, + 2, + 2, + 0, + 0, + 0, + 1, + 3 + ], + [ + 2, + 4, + 2, + 0, + 5, + 5, + 1, + 3 + ], + [ + 4, + 4, + 4, + 5, + 5, + 5, + 1, + 3 + ], + [ + 4, + 4, + 5, + 5, + 5, + 6, + 3, + 3 + ], + [ + 4, + 4, + 7, + 7, + 7, + 6, + 6, + 6 + ], + [ + 7, + 7, + 7, + 7, + 7, + 6, + 6, + 6 + ] + ], + "solution": [ + 2, + 5, + 0, + 7, + 1, + 3, + 6, + 4 + ] + }, + { + "clues": [ + [ + 2, + 0 + ], + [ + 4, + 5 + ], + [ + 6, + 3 + ] + ], + "id": "room-05", + "n": 8, + "regions": [ + [ + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 3 + ], + [ + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 3 + ], + [ + 2, + 2, + 2, + 1, + 0, + 0, + 3, + 3 + ], + [ + 2, + 5, + 2, + 4, + 4, + 4, + 4, + 3 + ], + [ + 2, + 5, + 5, + 4, + 4, + 4, + 3, + 3 + ], + [ + 5, + 5, + 5, + 6, + 4, + 4, + 4, + 3 + ], + [ + 5, + 5, + 5, + 6, + 6, + 7, + 7, + 7 + ], + [ + 6, + 6, + 6, + 6, + 6, + 7, + 7, + 7 + ] + ], + "solution": [ + 4, + 2, + 0, + 7, + 5, + 1, + 3, + 6 + ] + }, + { + "clues": [ + [ + 1, + 1 + ], + [ + 2, + 7 + ], + [ + 3, + 5 + ] + ], + "id": "room-06", + "n": 8, + "regions": [ + [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 1, + 1, + 7, + 4, + 0, + 3, + 3, + 2 + ], + [ + 5, + 7, + 7, + 4, + 4, + 3, + 3, + 2 + ], + [ + 5, + 7, + 4, + 4, + 4, + 3, + 3, + 2 + ], + [ + 5, + 7, + 4, + 4, + 6, + 3, + 2, + 2 + ], + [ + 5, + 7, + 6, + 6, + 6, + 6, + 2, + 2 + ], + [ + 5, + 7, + 7, + 6, + 6, + 6, + 6, + 2 + ] + ], + "solution": [ + 6, + 1, + 7, + 5, + 3, + 0, + 4, + 2 + ] + }, + { + "clues": [ + [ + 1, + 3 + ], + [ + 6, + 0 + ], + [ + 7, + 7 + ] + ], + "id": "room-07", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 2 + ], + [ + 0, + 3, + 0, + 1, + 1, + 1, + 2, + 2 + ], + [ + 0, + 3, + 0, + 1, + 1, + 2, + 2, + 2 + ], + [ + 3, + 3, + 3, + 1, + 4, + 4, + 4, + 2 + ], + [ + 6, + 3, + 3, + 5, + 4, + 4, + 4, + 4 + ], + [ + 6, + 5, + 5, + 5, + 5, + 7, + 7, + 4 + ], + [ + 6, + 6, + 5, + 5, + 5, + 7, + 7, + 7 + ], + [ + 6, + 6, + 6, + 6, + 5, + 7, + 7, + 7 + ] + ], + "solution": [ + 1, + 3, + 5, + 2, + 6, + 4, + 0, + 7 + ] + }, + { + "clues": [ + [ + 1, + 5 + ], + [ + 2, + 0 + ], + [ + 7, + 3 + ] + ], + "id": "room-08", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1 + ], + [ + 2, + 2, + 0, + 0, + 0, + 1, + 1, + 1 + ], + [ + 2, + 6, + 4, + 4, + 1, + 1, + 3, + 3 + ], + [ + 2, + 6, + 4, + 4, + 1, + 4, + 3, + 3 + ], + [ + 2, + 6, + 4, + 4, + 4, + 4, + 5, + 3 + ], + [ + 2, + 6, + 6, + 7, + 5, + 5, + 5, + 3 + ], + [ + 2, + 6, + 7, + 7, + 7, + 5, + 3, + 3 + ], + [ + 6, + 6, + 7, + 7, + 7, + 5, + 5, + 5 + ] + ], + "solution": [ + 2, + 5, + 0, + 7, + 4, + 6, + 1, + 3 + ] + }, + { + "clues": [ + [ + 2, + 6 + ], + [ + 4, + 2 + ], + [ + 6, + 3 + ] + ], + "id": "room-09", + "n": 8, + "regions": [ + [ + 3, + 3, + 1, + 1, + 1, + 0, + 0, + 0 + ], + [ + 3, + 3, + 1, + 1, + 1, + 1, + 0, + 0 + ], + [ + 3, + 3, + 4, + 1, + 2, + 2, + 2, + 0 + ], + [ + 3, + 4, + 4, + 2, + 2, + 4, + 2, + 0 + ], + [ + 3, + 4, + 4, + 4, + 4, + 4, + 2, + 5 + ], + [ + 7, + 7, + 7, + 6, + 6, + 5, + 5, + 5 + ], + [ + 7, + 7, + 6, + 6, + 6, + 5, + 5, + 5 + ], + [ + 7, + 7, + 6, + 6, + 6, + 5, + 5, + 5 + ] + ], + "solution": [ + 7, + 4, + 6, + 0, + 2, + 5, + 3, + 1 + ] + }, + { + "clues": [ + [ + 1, + 7 + ], + [ + 3, + 0 + ], + [ + 7, + 2 + ] + ], + "id": "room-10", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ], + [ + 0, + 0, + 0, + 4, + 4, + 1, + 1, + 1 + ], + [ + 3, + 0, + 4, + 4, + 2, + 2, + 2, + 1 + ], + [ + 3, + 3, + 4, + 4, + 2, + 2, + 2, + 1 + ], + [ + 3, + 3, + 3, + 4, + 4, + 2, + 2, + 5 + ], + [ + 3, + 7, + 6, + 6, + 6, + 5, + 5, + 5 + ], + [ + 7, + 7, + 7, + 6, + 6, + 5, + 5, + 5 + ], + [ + 7, + 7, + 7, + 7, + 6, + 6, + 6, + 5 + ] + ], + "solution": [ + 1, + 7, + 5, + 0, + 3, + 6, + 4, + 2 + ] + }, + { + "clues": [ + [ + 0, + 5 + ], + [ + 1, + 1 + ], + [ + 4, + 0 + ] + ], + "id": "room-11", + "n": 8, + "regions": [ + [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 3, + 3, + 2, + 0, + 0, + 0 + ], + [ + 1, + 1, + 3, + 2, + 2, + 0, + 0, + 5 + ], + [ + 4, + 3, + 3, + 3, + 2, + 2, + 5, + 5 + ], + [ + 4, + 4, + 4, + 3, + 2, + 2, + 5, + 5 + ], + [ + 4, + 4, + 6, + 6, + 6, + 7, + 5, + 5 + ], + [ + 4, + 4, + 6, + 6, + 6, + 7, + 7, + 5 + ], + [ + 4, + 4, + 6, + 6, + 7, + 7, + 7, + 5 + ] + ], + "solution": [ + 5, + 1, + 4, + 2, + 0, + 7, + 3, + 6 + ] + }, + { + "clues": [ + [ + 2, + 6 + ], + [ + 3, + 0 + ], + [ + 7, + 4 + ] + ], + "id": "room-12", + "n": 8, + "regions": [ + [ + 3, + 1, + 1, + 0, + 0, + 0, + 0, + 0 + ], + [ + 3, + 1, + 4, + 4, + 4, + 0, + 0, + 0 + ], + [ + 3, + 1, + 4, + 4, + 2, + 2, + 2, + 2 + ], + [ + 3, + 1, + 4, + 4, + 2, + 2, + 2, + 2 + ], + [ + 3, + 1, + 4, + 4, + 2, + 7, + 5, + 5 + ], + [ + 6, + 6, + 6, + 4, + 7, + 7, + 5, + 5 + ], + [ + 6, + 6, + 6, + 6, + 7, + 7, + 5, + 5 + ], + [ + 6, + 6, + 6, + 7, + 7, + 7, + 5, + 5 + ] + ], + "solution": [ + 5, + 1, + 6, + 0, + 3, + 7, + 2, + 4 + ] + }, + { + "clues": [ + [ + 1, + 5 + ], + [ + 4, + 7 + ], + [ + 7, + 2 + ] + ], + "id": "room-13", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ], + [ + 5, + 0, + 2, + 2, + 1, + 1, + 0, + 1 + ], + [ + 5, + 2, + 2, + 3, + 1, + 1, + 1, + 1 + ], + [ + 5, + 2, + 3, + 3, + 3, + 1, + 4, + 4 + ], + [ + 5, + 2, + 7, + 3, + 3, + 4, + 4, + 4 + ], + [ + 5, + 7, + 7, + 3, + 3, + 6, + 4, + 4 + ], + [ + 5, + 7, + 7, + 3, + 6, + 6, + 6, + 6 + ], + [ + 5, + 5, + 7, + 7, + 7, + 6, + 6, + 6 + ] + ], + "solution": [ + 3, + 5, + 1, + 4, + 7, + 0, + 6, + 2 + ] + }, + { + "clues": [ + [ + 0, + 2 + ], + [ + 2, + 0 + ], + [ + 6, + 6 + ] + ], + "id": "room-14", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ], + [ + 2, + 0, + 0, + 0, + 4, + 1, + 1, + 1 + ], + [ + 2, + 2, + 2, + 2, + 4, + 4, + 4, + 1 + ], + [ + 3, + 3, + 3, + 3, + 3, + 4, + 1, + 1 + ], + [ + 5, + 5, + 3, + 4, + 4, + 4, + 4, + 1 + ], + [ + 5, + 5, + 7, + 7, + 6, + 6, + 6, + 1 + ], + [ + 5, + 5, + 5, + 7, + 7, + 6, + 6, + 6 + ], + [ + 5, + 5, + 7, + 7, + 7, + 7, + 6, + 6 + ] + ], + "solution": [ + 2, + 7, + 0, + 3, + 5, + 1, + 6, + 4 + ] + }, + { + "clues": [ + [ + 2, + 7 + ], + [ + 4, + 3 + ], + [ + 6, + 1 + ] + ], + "id": "room-15", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2 + ], + [ + 3, + 0, + 3, + 1, + 1, + 1, + 1, + 2 + ], + [ + 3, + 0, + 3, + 1, + 1, + 1, + 2, + 2 + ], + [ + 3, + 3, + 3, + 4, + 5, + 5, + 2, + 2 + ], + [ + 3, + 3, + 4, + 4, + 5, + 5, + 2, + 7 + ], + [ + 6, + 6, + 6, + 4, + 4, + 5, + 2, + 7 + ], + [ + 6, + 6, + 6, + 4, + 7, + 5, + 5, + 7 + ], + [ + 6, + 6, + 4, + 4, + 7, + 7, + 7, + 7 + ] + ], + "solution": [ + 2, + 4, + 7, + 0, + 3, + 5, + 1, + 6 + ] + }, + { + "clues": [ + [ + 1, + 2 + ], + [ + 3, + 7 + ], + [ + 6, + 5 + ] + ], + "id": "room-16", + "n": 8, + "regions": [ + [ + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 0 + ], + [ + 2, + 1, + 1, + 1, + 4, + 0, + 0, + 0 + ], + [ + 2, + 2, + 1, + 1, + 4, + 0, + 0, + 0 + ], + [ + 2, + 2, + 1, + 4, + 4, + 3, + 3, + 3 + ], + [ + 2, + 5, + 1, + 4, + 4, + 4, + 3, + 3 + ], + [ + 5, + 5, + 5, + 7, + 4, + 4, + 3, + 3 + ], + [ + 5, + 5, + 7, + 7, + 6, + 6, + 6, + 6 + ], + [ + 5, + 7, + 7, + 7, + 7, + 6, + 6, + 6 + ] + ], + "solution": [ + 6, + 2, + 0, + 7, + 4, + 1, + 5, + 3 + ] + }, + { + "clues": [ + [ + 0, + 5 + ], + [ + 5, + 2 + ], + [ + 7, + 6 + ] + ], + "id": "room-17", + "n": 8, + "regions": [ + [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 2, + 0, + 0, + 3 + ], + [ + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3 + ], + [ + 1, + 5, + 2, + 2, + 4, + 4, + 3, + 3 + ], + [ + 6, + 5, + 5, + 4, + 4, + 4, + 4, + 3 + ], + [ + 6, + 6, + 5, + 5, + 5, + 7, + 4, + 3 + ], + [ + 6, + 6, + 6, + 5, + 5, + 7, + 7, + 7 + ], + [ + 6, + 6, + 6, + 7, + 7, + 7, + 7, + 7 + ] + ], + "solution": [ + 5, + 1, + 3, + 7, + 4, + 2, + 0, + 6 + ] + }, + { + "clues": [ + [ + 0, + 2 + ], + [ + 4, + 0 + ], + [ + 7, + 5 + ] + ], + "id": "room-18", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 0, + 1, + 2, + 2 + ], + [ + 4, + 0, + 0, + 1, + 1, + 1, + 2, + 2 + ], + [ + 4, + 0, + 3, + 1, + 5, + 1, + 2, + 2 + ], + [ + 4, + 4, + 3, + 3, + 5, + 1, + 1, + 2 + ], + [ + 4, + 4, + 3, + 3, + 5, + 5, + 2, + 2 + ], + [ + 6, + 4, + 3, + 5, + 5, + 5, + 5, + 7 + ], + [ + 6, + 6, + 6, + 6, + 7, + 7, + 7, + 7 + ], + [ + 6, + 6, + 6, + 6, + 7, + 7, + 7, + 7 + ] + ], + "solution": [ + 2, + 4, + 7, + 3, + 0, + 6, + 1, + 5 + ] + }, + { + "clues": [ + [ + 0, + 6 + ], + [ + 1, + 1 + ], + [ + 6, + 4 + ] + ], + "id": "room-19", + "n": 8, + "regions": [ + [ + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 2 + ], + [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 3, + 3, + 3, + 0, + 3, + 2, + 2, + 2 + ], + [ + 3, + 5, + 3, + 3, + 3, + 2, + 4, + 2 + ], + [ + 5, + 5, + 5, + 5, + 6, + 4, + 4, + 2 + ], + [ + 7, + 5, + 5, + 5, + 6, + 4, + 4, + 4 + ], + [ + 7, + 7, + 7, + 7, + 6, + 6, + 4, + 4 + ], + [ + 7, + 7, + 6, + 6, + 6, + 6, + 6, + 4 + ] + ], + "solution": [ + 6, + 1, + 7, + 3, + 5, + 2, + 4, + 0 + ] + }, + { + "clues": [ + [ + 0, + 2 + ], + [ + 4, + 0 + ], + [ + 5, + 3 + ] + ], + "id": "room-20", + "n": 8, + "regions": [ + [ + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 0, + 3, + 1, + 1, + 2 + ], + [ + 4, + 4, + 4, + 0, + 3, + 1, + 2, + 2 + ], + [ + 4, + 4, + 5, + 3, + 3, + 3, + 2, + 2 + ], + [ + 4, + 4, + 5, + 5, + 3, + 3, + 2, + 6 + ], + [ + 4, + 4, + 5, + 5, + 5, + 6, + 6, + 6 + ], + [ + 7, + 4, + 7, + 5, + 5, + 5, + 6, + 6 + ], + [ + 7, + 7, + 7, + 7, + 7, + 7, + 6, + 6 + ] + ], + "solution": [ + 2, + 5, + 7, + 4, + 0, + 3, + 6, + 1 + ] + } +] diff --git a/data/tutorial.json b/data/tutorial.json new file mode 100644 index 0000000..8fa7f01 --- /dev/null +++ b/data/tutorial.json @@ -0,0 +1,13 @@ +{ + "id": "tutorial", + "n": 5, + "regions": [ + [0, 0, 0, 0, 0], + [1, 1, 1, 1, 0], + [3, 1, 4, 2, 2], + [3, 3, 4, 2, 2], + [3, 4, 4, 4, 2] + ], + "solution": [4, 1, 3, 0, 2], + "clues": [[2, 3]] +} diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..554d83f --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,61 @@ +[preset.0] + +name="Android" +platform="Android" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="data/*.json" +exclude_filter="art/guests/source/*" +export_path="build/Ratdoku-v0.1.0-alpha.apk" +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +gradle_build/use_gradle_build=false +gradle_build/gradle_build_directory="" +gradle_build/android_source_template="" +gradle_build/compress_native_libraries=false +gradle_build/export_format=0 +gradle_build/min_sdk="" +gradle_build/target_sdk="" +architectures/armeabi-v7a=false +architectures/arm64-v8a=true +architectures/x86=false +architectures/x86_64=false +version/code=1 +version/name="0.1.0" +package/unique_name="com.ratdoku.game" +package/name="Ratdoku" +package/signed=true +package/app_category=2 +package/retain_data_on_uninstall=false +package/exclude_from_recents=false +package/show_in_android_tv=false +package/show_in_app_library=true +package/show_as_launcher_app=false +launcher_icons/main_192x192="res://icon_192.png" +launcher_icons/adaptive_foreground_432x432="" +launcher_icons/adaptive_background_432x432="" +graphics/opengl_debug=false +xr_features/xr_mode=0 +screen/immersive_mode=true +screen/support_small=true +screen/support_normal=true +screen/support_large=true +screen/support_xlarge=true +user_data_backup/allow=false +command_line/extra_args="" +apk_expansion/enable=false +apk_expansion/SALT="" +apk_expansion/public_key="" +permissions/custom_permissions=PackedStringArray() diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..a601446 Binary files /dev/null and b/icon.png differ diff --git a/icon_192.png b/icon_192.png new file mode 100644 index 0000000..3c26ff7 Binary files /dev/null and b/icon_192.png differ diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..5231aad --- /dev/null +++ b/project.godot @@ -0,0 +1,50 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Ratdoku" +run/main_scene="res://scenes/Main.tscn" +config/version="0.1.0-alpha" +config/features=PackedStringArray("4.7", "GL Compatibility") +config/icon="res://icon.png" + +[autoload] + +SaveGame="*res://scripts/SaveGame.gd" + +[display] + +window/size/viewport_width=720 +window/size/viewport_height=1280 +window/size/window_width_override=540 +window/size/window_height_override=960 +window/stretch/mode="canvas_items" +window/stretch/aspect="expand" +window/handheld/orientation=1 + +[input_devices] + +pointing/emulate_mouse_from_touch=true + +[physics] + +3d/physics_engine="Jolt Physics" + +[rendering] + +rendering_device/driver.windows="d3d12" +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +textures/vram_compression/import_etc2_astc=true + +[debug] + +gdscript/warnings/inference_on_variant=1 diff --git a/scenes/Board.tscn b/scenes/Board.tscn new file mode 100644 index 0000000..744ab2a --- /dev/null +++ b/scenes/Board.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://scripts/Board.gd" id="1_board"] + +[node name="Board" type="Control"] +custom_minimum_size = Vector2(320, 320) +script = ExtResource("1_board") diff --git a/scenes/Game.tscn b/scenes/Game.tscn new file mode 100644 index 0000000..082526b --- /dev/null +++ b/scenes/Game.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://scripts/Game.gd" id="1_game"] + +[node name="Game" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_game") diff --git a/scenes/Home.tscn b/scenes/Home.tscn new file mode 100644 index 0000000..472468c --- /dev/null +++ b/scenes/Home.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://scripts/Home.gd" id="1_home"] + +[node name="Home" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_home") diff --git a/scenes/Main.tscn b/scenes/Main.tscn new file mode 100644 index 0000000..f4ad2cd --- /dev/null +++ b/scenes/Main.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://scripts/Main.gd" id="1_main"] + +[node name="Main" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_main") diff --git a/scripts/Board.gd b/scripts/Board.gd new file mode 100644 index 0000000..054b501 --- /dev/null +++ b/scripts/Board.gd @@ -0,0 +1,546 @@ +class_name Board +extends Control + +## The whole puzzle board: room fills, walls, patterns, rat tokens, input. +## One Control with custom drawing is much cheaper and cleaner than 64 nodes. + +signal changed +signal solved +signal mistake + +const EMPTY := 0 +const X := 1 +const RAT := 2 + +var n := 8 +var regions: Array = [] +var solution: Array = [] +var clues: Array = [] +var fixed := {} +var cells: Array = [] +var auto_x: Array = [] +var conflict_cells: Array = [] +var history: Array = [] +var level_id := "" + +var cell_size := 0.0 +var board_origin := Vector2.ZERO +var last_placed := Vector2i(-1, -1) +var pop_time := 0.0 +var press_cell := Vector2i(-1, -1) +var press_elapsed := 0.0 +var hold_fired := false +var hold_seconds := 0.35 +var show_patterns := true +var reduce_motion := false +var region_rats: Array = [] +var region_textures := {} + +var rat_texture: Texture2D = null + + +func _ready() -> void: + mouse_filter = Control.MOUSE_FILTER_STOP + set_process(true) + if ResourceLoader.exists("res://art/crumb_head.png"): + rat_texture = load("res://art/crumb_head.png") + + var save := get_node_or_null("/root/SaveGame") + if save != null: + show_patterns = bool(save.get_setting("patterns")) + reduce_motion = bool(save.get_setting("reduce_motion")) + hold_seconds = float(save.get_setting("hold_seconds")) + save.settings_changed.connect(_on_settings_changed) + + +func _on_settings_changed() -> void: + var save := get_node_or_null("/root/SaveGame") + if save == null: + return + show_patterns = bool(save.get_setting("patterns")) + reduce_motion = bool(save.get_setting("reduce_motion")) + hold_seconds = float(save.get_setting("hold_seconds")) + queue_redraw() + + +func _process(delta: float) -> void: + if pop_time > 0.0 and not reduce_motion: + pop_time = max(0.0, pop_time - delta) + queue_redraw() + + if press_cell.x >= 0 and not hold_fired: + press_elapsed += delta + if press_elapsed >= hold_seconds: + hold_fired = true + _toggle_rat(press_cell) + else: + queue_redraw() + + +func _notification(what: int) -> void: + if what == NOTIFICATION_RESIZED: + queue_redraw() + + +func set_level(level: Dictionary) -> void: + n = int(level.get("n", 8)) + regions = level.get("regions", []) + solution = level.get("solution", []) + clues = level.get("clues", []) + level_id = str(level.get("id", "")) + + _assign_region_rats() + + cells = [] + auto_x = [] + for r in n: + var row := [] + var marks := [] + for c in n: + row.append(EMPTY) + marks.append(false) + cells.append(row) + auto_x.append(marks) + + fixed.clear() + for clue in clues: + var r := int(clue[0]) + var c := int(clue[1]) + if r >= 0 and r < n and c >= 0 and c < n: + cells[r][c] = RAT + fixed[Vector2i(r, c)] = true + + history.clear() + conflict_cells.clear() + last_placed = Vector2i(-1, -1) + pop_time = 0.0 + _recompute_auto() + conflict_cells = Rules.conflicts(cells, regions) + queue_redraw() + changed.emit() + + +func _draw() -> void: + if regions.size() != n or n <= 0: + return + + _update_layout() + var side := cell_size * n + var board_rect := Rect2(board_origin, Vector2(side, side)) + + # Soft drop shadow + draw_rect(Rect2(board_rect.position + Vector2(5, 8), board_rect.size), Color(0.29, 0.20, 0.14, 0.10)) + + # Room fills and patterns + for r in n: + for c in n: + var rect := _cell_rect(r, c) + var region := int(regions[r][c]) + var color: Color = Palette.REGION_COLORS[region % Palette.REGION_COLORS.size()] + draw_rect(rect.grow(0.6), color) + _draw_pattern(rect, region) + + # Hairline grid + for i in range(n + 1): + var x := board_origin.x + i * cell_size + var y := board_origin.y + i * cell_size + draw_line(Vector2(x, board_origin.y), Vector2(x, board_origin.y + side), Palette.GRID, 1.0, true) + draw_line(Vector2(board_origin.x, y), Vector2(board_origin.x + side, y), Palette.GRID, 1.0, true) + + # Thick walls between rooms + var wall_width: float = max(3.0, cell_size * 0.07) + for r in n: + for c in n: + var rect := _cell_rect(r, c) + if c == n - 1 or int(regions[r][c]) != int(regions[r][c + 1]): + draw_line( + rect.position + Vector2(cell_size, 0), + rect.position + Vector2(cell_size, cell_size), + Palette.WALL, + wall_width, + true + ) + if r == n - 1 or int(regions[r][c]) != int(regions[r + 1][c]): + draw_line( + rect.position + Vector2(0, cell_size), + rect.position + Vector2(cell_size, cell_size), + Palette.WALL, + wall_width, + true + ) + + # Outer frame + draw_rect(board_rect, Palette.WALL, false, wall_width + 1.0, true) + + # Marks and rats + for r in n: + for c in n: + var value := int(cells[r][c]) + if value == RAT: + _draw_rat(Vector2i(r, c)) + elif value == X: + _draw_x(_cell_rect(r, c), Color(0.29, 0.20, 0.14, 0.62)) + elif auto_x[r][c]: + _draw_x(_cell_rect(r, c), Color(0.29, 0.20, 0.14, 0.28)) + + # Soft red ring around any rat that breaks a rule. + for cell in conflict_cells: + var center := _cell_rect(cell.x, cell.y).get_center() + draw_arc(center, cell_size * 0.42, 0.0, TAU, 32, Palette.RED, 3.0, true) + + # Hold progress: fills a gold ring before checking a guest in. + if press_cell.x >= 0 and not hold_fired: + var center := _cell_rect(press_cell.x, press_cell.y).get_center() + var t: float = clamp(press_elapsed / hold_seconds, 0.0, 1.0) + draw_arc(center, cell_size * 0.40, -PI * 0.5, -PI * 0.5 + TAU * t, 32, Palette.GOLD, 3.0, true) + + +func _update_layout() -> void: + var side: float = min(size.x, size.y) - 12.0 + side = max(0.0, side) + cell_size = side / float(n) + board_origin = (size - Vector2(side, side)) * 0.5 + + +func _cell_rect(r: int, c: int) -> Rect2: + return Rect2( + board_origin + Vector2(c * cell_size, r * cell_size), + Vector2(cell_size, cell_size) + ) + + +func _draw_pattern(rect: Rect2, region: int) -> void: + if not show_patterns: + return + var pattern := region % 5 + var tint := Color(0.29, 0.20, 0.14, 0.09) + var s := rect.size.x + + if pattern == 0: + for i in range(3): + for j in range(3): + var p := rect.position + Vector2((i + 0.5) * s / 3.0, (j + 0.5) * s / 3.0) + draw_circle(p, max(1.0, s * 0.018), tint) + elif pattern == 1: + for i in [0.33, 0.66]: + draw_line(rect.position + Vector2(0, s * i), rect.position + Vector2(s, s * i), tint, max(1.0, s * 0.012), true) + elif pattern == 2: + for i in [0.33, 0.66]: + draw_line(rect.position + Vector2(s * i, 0), rect.position + Vector2(s * i, s), tint, max(1.0, s * 0.012), true) + elif pattern == 3: + for i in [0.33, 0.66]: + draw_line(rect.position + Vector2(0, s * i), rect.position + Vector2(s, s * i), tint, max(1.0, s * 0.010), true) + draw_line(rect.position + Vector2(0, s * (1.0 - i)), rect.position + Vector2(s, s * (1.0 - i)), tint, max(1.0, s * 0.010), true) + else: + for i in range(2): + for j in range(2): + var p := rect.position + Vector2((i + 0.5) * s / 2.0, (j + 0.5) * s / 2.0) + draw_circle(p, max(1.5, s * 0.034), tint) + + +func _draw_x(rect: Rect2, color: Color) -> void: + var inset := rect.size.x * 0.30 + var a := rect.position + Vector2(inset, inset) + var b := rect.position + Vector2(rect.size.x - inset, rect.size.y - inset) + var c := rect.position + Vector2(rect.size.x - inset, inset) + var d := rect.position + Vector2(inset, rect.size.y - inset) + draw_line(a, b, color, max(2.0, rect.size.x * 0.045), true) + draw_line(c, d, color, max(2.0, rect.size.x * 0.045), true) + + +func _assign_region_rats() -> void: + # v0.1.0-alpha: no per-room guest tokens yet. Leave the table empty so every + # rat on the board falls back to the shared Crumb head token. + if true: + return + + region_rats.clear() + region_textures.clear() + + var ids: Array = Guests.ids() + if ids.is_empty(): + return + + var rng := RandomNumberGenerator.new() + rng.seed = level_id.hash() + + for i in range(ids.size() - 1, 0, -1): + var j := rng.randi_range(0, i) + var tmp = ids[i] + ids[i] = ids[j] + ids[j] = tmp + + for region in range(n): + var id := str(ids[region % ids.size()]) + region_rats.append(id) + var path := "res://art/guests/heads/%s.png" % id + if ResourceLoader.exists(path): + region_textures[region] = load(path) + + +func _draw_rat(cell: Vector2i) -> void: + var rect := _cell_rect(cell.x, cell.y) + var center := rect.get_center() + var s := rect.size.x + var region := int(regions[cell.x][cell.y]) + + var texture: Texture2D = null + if region_textures.has(region): + texture = region_textures[region] + else: + texture = rat_texture + + if texture != null: + var token := s * 0.86 + draw_circle(center, s * 0.40, Color(1.0, 0.98, 0.93, 0.92)) + draw_texture_rect(texture, Rect2(center - Vector2(token, token) * 0.5, Vector2(token, token)), false) + if fixed.has(cell): + draw_arc(center, s * 0.40, 0.0, TAU, 32, Palette.GOLD, 3.0, true) + return + + var pop := 1.0 + if not reduce_motion and cell == last_placed and pop_time > 0.0: + var k := 1.0 - pop_time / 0.26 + pop = 1.0 + 0.16 * sin(k * PI) + + draw_set_transform(center, 0.0, Vector2(pop, pop)) + + # Cream sticker behind the token + draw_circle(Vector2.ZERO, s * 0.37, Color(1.0, 0.98, 0.93, 0.94)) + if fixed.has(cell): + draw_arc(Vector2.ZERO, s * 0.37, 0.0, TAU, 32, Palette.GOLD, 3.0, true) + else: + draw_arc(Vector2.ZERO, s * 0.37, 0.0, TAU, 32, Color(0.29, 0.20, 0.14, 0.12), 1.5, true) + + var fur := Color("8f6a4a") + var cream := Color("f6e4c6") + var pink := Color("e0a29a") + var ink := Palette.INK + + # Ears + for side in [-1.0, 1.0]: + var ear := Vector2(0.135 * side, -0.135) * s + draw_circle(ear, 0.095 * s, fur) + draw_circle(ear, 0.060 * s, pink) + + # Head + draw_circle(Vector2(0.0, 0.005 * s), 0.160 * s, fur) + + # Muzzle + draw_circle(Vector2(0.0, 0.080 * s), 0.090 * s, cream) + + # Eyes + for side in [-1.0, 1.0]: + var eye := Vector2(0.060 * side, -0.025) * s + draw_circle(eye, 0.020 * s, ink) + draw_circle(eye + Vector2(0.006, -0.006) * s, 0.006 * s, Palette.WHITE) + + # Nose and smile + draw_circle(Vector2(0.0, 0.070 * s), 0.015 * s, Color("c9736b")) + draw_arc(Vector2(0.0, 0.080 * s), 0.034 * s, 0.25, PI - 0.25, 14, ink, 1.5, true) + + # Whiskers + var whisker := Color(0.29, 0.20, 0.14, 0.42) + for side in [-1.0, 1.0]: + for i in range(2): + var y := 0.070 + i * 0.028 + draw_line( + Vector2(0.045 * side, 0.080) * s, + Vector2(0.205 * side, y) * s, + whisker, + 1.0, + true + ) + + draw_set_transform(Vector2.ZERO, 0.0, Vector2.ONE) + + +func _gui_input(event: InputEvent) -> void: + if event is InputEventMouseMotion and press_cell.x >= 0: + if _pos_to_cell(event.position) != press_cell: + press_cell = Vector2i(-1, -1) + hold_fired = false + queue_redraw() + return + + if event is InputEventMouseButton: + var cell := _pos_to_cell(event.position) + + if event.button_index == MOUSE_BUTTON_LEFT: + if event.pressed: + if cell.x < 0: + return + press_cell = cell + press_elapsed = 0.0 + hold_fired = false + queue_redraw() + accept_event() + else: + var was_cell := press_cell + var fired := hold_fired + press_cell = Vector2i(-1, -1) + hold_fired = false + queue_redraw() + if not fired and was_cell.x >= 0 and cell == was_cell: + _tap(was_cell) + accept_event() + + elif event.button_index == MOUSE_BUTTON_RIGHT and event.pressed: + if cell.x >= 0: + _toggle_rat(cell) + accept_event() + + +func _pos_to_cell(pos: Vector2) -> Vector2i: + if cell_size <= 0.0: + return Vector2i(-1, -1) + var local := pos - board_origin + if local.x < 0.0 or local.y < 0.0: + return Vector2i(-1, -1) + var c := int(local.x / cell_size) + var r := int(local.y / cell_size) + if r < 0 or r >= n or c < 0 or c >= n: + return Vector2i(-1, -1) + return Vector2i(r, c) + + +## A short tap marks an X (or removes a mark/guest). It never places a guest. +func _tap(cell: Vector2i) -> void: + if fixed.has(cell): + return + var value := int(cells[cell.x][cell.y]) + if value == RAT: + _set_cell(cell, EMPTY) + elif value == X: + _set_cell(cell, EMPTY) + elif not auto_x[cell.x][cell.y]: + _set_cell(cell, X) + + +## Hold (mobile/PC) or right-click (PC): check a guest in or out. +func _toggle_rat(cell: Vector2i) -> void: + if fixed.has(cell): + return + if int(cells[cell.x][cell.y]) == RAT: + _set_cell(cell, EMPTY) + else: + _set_cell(cell, RAT) + + +func _set_cell(cell: Vector2i, value: int) -> void: + _push_history() + cells[cell.x][cell.y] = value + + if value == RAT: + last_placed = cell + pop_time = 0.0 if reduce_motion else 0.26 + + _after_change() + + if value == RAT and conflict_cells.has(cell): + mistake.emit() + + +func _after_change() -> void: + _recompute_auto() + conflict_cells = Rules.conflicts(cells, regions) + queue_redraw() + changed.emit() + if Rules.is_valid(cells, regions): + solved.emit() + + +func _push_history() -> void: + history.append(_copy_cells()) + if history.size() > 200: + history.pop_front() + + +func _copy_cells() -> Array: + var copy := [] + for r in n: + var row := [] + for c in n: + row.append(int(cells[r][c])) + copy.append(row) + return copy + + +func undo() -> void: + if history.is_empty(): + return + cells = history.pop_back() + _after_change() + + +func restart() -> void: + _push_history() + for r in n: + for c in n: + if not fixed.has(Vector2i(r, c)): + cells[r][c] = EMPTY + _after_change() + + +func hint() -> bool: + if solution.size() != n: + return false + for r in n: + var c := int(solution[r]) + if int(cells[r][c]) == RAT: + continue + + _push_history() + # Remove any wrong rats that would block the correct one. + for rr in n: + for cc in n: + if int(cells[rr][cc]) != RAT: + continue + if fixed.has(Vector2i(rr, cc)): + continue + if _would_conflict(Vector2i(rr, cc), Vector2i(r, c)): + cells[rr][cc] = EMPTY + cells[r][c] = RAT + last_placed = Vector2i(r, c) + pop_time = 0.0 if reduce_motion else 0.26 + _after_change() + return true + return false + + +func _would_conflict(a: Vector2i, b: Vector2i) -> bool: + if a == b: + return false + if a.x == b.x or a.y == b.y: + return true + if int(regions[a.x][a.y]) == int(regions[b.x][b.y]): + return true + return abs(a.x - b.x) <= 1 and abs(a.y - b.y) <= 1 + + +func _recompute_auto() -> void: + for r in n: + for c in n: + auto_x[r][c] = false + + for r in n: + for c in n: + if int(cells[r][c]) != RAT: + continue + + for i in n: + auto_x[r][i] = true + auto_x[i][c] = true + + var region := int(regions[r][c]) + for rr in n: + for cc in n: + if int(regions[rr][cc]) == region: + auto_x[rr][cc] = true + + for dr in range(-1, 2): + for dc in range(-1, 2): + var rr := r + dr + var cc := c + dc + if rr >= 0 and rr < n and cc >= 0 and cc < n: + auto_x[rr][cc] = true diff --git a/scripts/Board.gd.uid b/scripts/Board.gd.uid new file mode 100644 index 0000000..028f90c --- /dev/null +++ b/scripts/Board.gd.uid @@ -0,0 +1 @@ +uid://crr3c5broksxt diff --git a/scripts/Game.gd b/scripts/Game.gd new file mode 100644 index 0000000..fb10a5d --- /dev/null +++ b/scripts/Game.gd @@ -0,0 +1,248 @@ +extends Control + +signal back_pressed + +const BoardScene = preload("res://scenes/Board.tscn") +const DEFAULT_STATUS := "One guest per room, floor and corridor.\nTap = X · Hold or right-click = check in." + +var levels: Array = [] +var level_index := 0 +var started_at := 0 +var elapsed_ms := 0 +var win_shown := false +var current_level_id := "" + +var board: Board +var level_label: Label +var timer_label: Label +var status_label: Label +var win_detail: Label +var overlay: ColorRect + + +func _ready() -> void: + levels = Levels.load_all() + _build_ui() + set_process(true) + + +func _build_ui() -> void: + var margin := MarginContainer.new() + margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + margin.add_theme_constant_override("margin_left", 20) + margin.add_theme_constant_override("margin_right", 20) + margin.add_theme_constant_override("margin_top", 18) + margin.add_theme_constant_override("margin_bottom", 18) + add_child(margin) + + var column := VBoxContainer.new() + column.add_theme_constant_override("separation", 10) + margin.add_child(column) + + # Top bar + var top := HBoxContainer.new() + top.add_theme_constant_override("separation", 10) + column.add_child(top) + + var back := UI.button("‹", false, 44) + back.custom_minimum_size = Vector2(48, 44) + back.add_theme_font_size_override("font_size", 30) + back.pressed.connect(_on_back) + top.add_child(back) + + level_label = UI.label("Room 1", 20, Palette.MUTED) + level_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT + level_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL + top.add_child(level_label) + + timer_label = UI.label("00:00", 18, Palette.MUTED) + timer_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT + timer_label.custom_minimum_size = Vector2(72, 0) + top.add_child(timer_label) + + # Board + board = BoardScene.instantiate() as Board + board.custom_minimum_size = Vector2(320, 320) + board.size_flags_horizontal = Control.SIZE_EXPAND_FILL + board.size_flags_vertical = Control.SIZE_EXPAND_FILL + board.changed.connect(_on_board_changed) + board.solved.connect(_on_solved) + board.mistake.connect(_on_mistake) + column.add_child(board) + + # Status + status_label = UI.label(DEFAULT_STATUS, 17, Palette.MUTED) + status_label.custom_minimum_size = Vector2(0, 56) + status_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL + column.add_child(status_label) + + # Bottom actions + var actions := HBoxContainer.new() + actions.add_theme_constant_override("separation", 8) + column.add_child(actions) + + var undo := UI.button("Undo", false, 52) + undo.size_flags_horizontal = Control.SIZE_EXPAND_FILL + undo.pressed.connect(_on_undo) + actions.add_child(undo) + + var restart := UI.button("Restart", false, 52) + restart.size_flags_horizontal = Control.SIZE_EXPAND_FILL + restart.pressed.connect(_on_restart) + actions.add_child(restart) + + var hint := UI.button("Hint", true, 52) + hint.size_flags_horizontal = Control.SIZE_EXPAND_FILL + hint.pressed.connect(_on_hint) + actions.add_child(hint) + + _build_win_overlay() + + +func _build_win_overlay() -> void: + overlay = ColorRect.new() + overlay.color = Color(0.18, 0.12, 0.08, 0.48) + overlay.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + overlay.mouse_filter = Control.MOUSE_FILTER_STOP + overlay.visible = false + add_child(overlay) + + var center := CenterContainer.new() + center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + overlay.add_child(center) + + var panel := UI.panel(Palette.CREAM, 34, 28) + panel.custom_minimum_size = Vector2(420, 0) + center.add_child(panel) + + var box := VBoxContainer.new() + box.add_theme_constant_override("separation", 10) + panel.add_child(box) + + var portrait_center := CenterContainer.new() + box.add_child(portrait_center) + var portrait := _make_win_portrait() + portrait.custom_minimum_size = Vector2(170, 170) + portrait_center.add_child(portrait) + + box.add_child(UI.label("Everyone checked in!", 34)) + win_detail = UI.label("Room 1 · 00:00", 18, Palette.MUTED) + box.add_child(win_detail) + box.add_child(UI.label("Sweet dreams, little guests.", 18, Palette.MUTED)) + + var next := UI.button("Next room", true, 56) + box.add_child(next) + next.pressed.connect(_on_next) + + +func _make_win_portrait() -> Control: + if ResourceLoader.exists("res://art/crumb_head.png"): + var texture_rect := TextureRect.new() + texture_rect.texture = load("res://art/crumb_head.png") + texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE + texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED + return texture_rect + return RatPortrait.new() + + +func start_level(index: int) -> void: + if levels.is_empty(): + status_label.text = "No rooms found — check data/levels.json." + status_label.add_theme_color_override("font_color", Palette.RED) + return + + level_index = clampi(index, 0, levels.size() - 1) + var level: Dictionary = levels[level_index] + current_level_id = str(level.get("id", "")) + board.set_level(level) + + level_label.text = "Room %d of %d" % [level_index + 1, levels.size()] + started_at = Time.get_ticks_msec() + elapsed_ms = 0 + win_shown = false + overlay.visible = false + if level.get("clues", []).size() > 0: + status_label.text = "Gold-ringed guests are already checked in.\nTap = X · Hold or right-click = check in." + else: + status_label.text = DEFAULT_STATUS + status_label.add_theme_color_override("font_color", Palette.MUTED) + + +func _process(_delta: float) -> void: + timer_label.visible = bool(SaveGame.get_setting("show_timer")) + if not visible or win_shown or started_at == 0: + return + elapsed_ms = Time.get_ticks_msec() - started_at + timer_label.text = _format_time(elapsed_ms) + + +func _format_time(ms: int) -> String: + var total: int = int(ms / 1000.0) + var minutes: int = total / 60 + var seconds: int = total % 60 + return "%02d:%02d" % [minutes, seconds] + + +func _on_board_changed() -> void: + if win_shown: + return + status_label.text = DEFAULT_STATUS + status_label.add_theme_color_override("font_color", Palette.MUTED) + + +func _on_mistake() -> void: + status_label.text = "That room's already taken — undo or try another." + status_label.add_theme_color_override("font_color", Palette.RED) + + +func _on_solved() -> void: + if win_shown: + return + win_shown = true + status_label.text = "Everyone checked in." + status_label.add_theme_color_override("font_color", Palette.INK) + win_detail.text = "Room %d · %s" % [level_index + 1, _format_time(elapsed_ms)] + + SaveGame.complete_room(current_level_id, level_index + 1) + + await get_tree().create_timer(0.45).timeout + if win_shown: + overlay.visible = true + + +func _on_undo() -> void: + win_shown = false + overlay.visible = false + board.undo() + + +func _on_restart() -> void: + win_shown = false + overlay.visible = false + started_at = Time.get_ticks_msec() + elapsed_ms = 0 + board.restart() + + +func _on_hint() -> void: + if board.hint(): + if not win_shown: + status_label.text = "Crumb found a guest who was waiting." + status_label.add_theme_color_override("font_color", Palette.MUTED) + else: + if not win_shown: + status_label.text = "Every guest is already checked in." + status_label.add_theme_color_override("font_color", Palette.MUTED) + + +func _on_next() -> void: + if level_index + 1 < levels.size(): + start_level(level_index + 1) + else: + _on_back() + + +func _on_back() -> void: + win_shown = false + overlay.visible = false + back_pressed.emit() diff --git a/scripts/Game.gd.uid b/scripts/Game.gd.uid new file mode 100644 index 0000000..09ea9da --- /dev/null +++ b/scripts/Game.gd.uid @@ -0,0 +1 @@ +uid://cenbkgbgqff87 diff --git a/scripts/Guests.gd b/scripts/Guests.gd new file mode 100644 index 0000000..494dbfd --- /dev/null +++ b/scripts/Guests.gd @@ -0,0 +1,47 @@ +class_name Guests +extends RefCounted + +const PATH := "res://data/guests.json" + +static var _cache: Array = [] + + +static func all() -> Array: + if _cache.is_empty(): + if not FileAccess.file_exists(PATH): + return [] + var file := FileAccess.open(PATH, FileAccess.READ) + if file == null: + return [] + var parsed = JSON.parse_string(file.get_as_text()) + file.close() + if typeof(parsed) == TYPE_ARRAY: + _cache = parsed + return _cache + + +static func by_id(id: String) -> Dictionary: + for guest in all(): + if str(guest.get("id", "")) == id: + return guest + return {} + + +static func ids() -> Array: + var out: Array = [] + for guest in all(): + out.append(str(guest.get("id", ""))) + return out + + +static func for_room(room_number: int) -> Dictionary: + for guest in all(): + if int(guest.get("unlock_room", -1)) == room_number: + return guest + return {} + + +static func portrait(id: String, size: String = "thumbs") -> String: + if size == "full": + return "res://art/guests/cards/%s.png" % id + return "res://art/guests/%s/%s.png" % [size, id] diff --git a/scripts/Guests.gd.uid b/scripts/Guests.gd.uid new file mode 100644 index 0000000..b272ec0 --- /dev/null +++ b/scripts/Guests.gd.uid @@ -0,0 +1 @@ +uid://tmawomp3s1s diff --git a/scripts/Home.gd b/scripts/Home.gd new file mode 100644 index 0000000..c4f4bd2 --- /dev/null +++ b/scripts/Home.gd @@ -0,0 +1,62 @@ +extends Control + +signal play_pressed + + +func _ready() -> void: + var margin := MarginContainer.new() + margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + margin.add_theme_constant_override("margin_left", 28) + margin.add_theme_constant_override("margin_right", 28) + margin.add_theme_constant_override("margin_top", 28) + margin.add_theme_constant_override("margin_bottom", 28) + add_child(margin) + + var column := VBoxContainer.new() + column.alignment = BoxContainer.ALIGNMENT_CENTER + column.add_theme_constant_override("separation", 10) + margin.add_child(column) + + column.add_child(UI.label("Ratdoku", 68)) + column.add_child(UI.label("A cozy rat hotel puzzle", 24, Palette.MUTED)) + + var gap := Control.new() + gap.custom_minimum_size = Vector2(0, 14) + column.add_child(gap) + + var portrait_center := CenterContainer.new() + column.add_child(portrait_center) + var card := UI.panel(Palette.CREAM, 40, 18) + card.custom_minimum_size = Vector2(340, 340) + portrait_center.add_child(card) + + var mascot := _make_mascot() + mascot.custom_minimum_size = Vector2(300, 300) + card.add_child(mascot) + + column.add_child(UI.label("Crumb, innkeeper", 16, Palette.MUTED)) + column.add_child(UI.label("Every guest gets a room of their own.", 20)) + column.add_child(UI.label("Tap = X · Hold or right-click = check in", 16, Palette.MUTED)) + + var gap2 := Control.new() + gap2.custom_minimum_size = Vector2(0, 10) + column.add_child(gap2) + + var play := UI.button("Check in", true, 64) + play.custom_minimum_size = Vector2(280, 64) + var play_center := CenterContainer.new() + play_center.add_child(play) + column.add_child(play_center) + play.pressed.connect(func() -> void: play_pressed.emit()) + + column.add_child(UI.label("No ads. No lives. Just rats.", 16, Palette.MUTED)) + + +func _make_mascot() -> Control: + if ResourceLoader.exists("res://art/crumb.png"): + var texture_rect := TextureRect.new() + texture_rect.texture = load("res://art/crumb.png") + texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE + texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED + return texture_rect + return RatPortrait.new() diff --git a/scripts/Home.gd.uid b/scripts/Home.gd.uid new file mode 100644 index 0000000..e6b067f --- /dev/null +++ b/scripts/Home.gd.uid @@ -0,0 +1 @@ +uid://bvt3jm3kpjs3x diff --git a/scripts/Levels.gd b/scripts/Levels.gd new file mode 100644 index 0000000..12d10ef --- /dev/null +++ b/scripts/Levels.gd @@ -0,0 +1,24 @@ +class_name Levels +extends RefCounted + +const PATH := "res://data/levels.json" + + +static func load_all() -> Array: + if not FileAccess.file_exists(PATH): + push_warning("No level file at %s. Run tools/generate_levels.gd." % PATH) + return [] + + var file := FileAccess.open(PATH, FileAccess.READ) + if file == null: + push_warning("Could not open %s." % PATH) + return [] + + var parsed = JSON.parse_string(file.get_as_text()) + file.close() + + if typeof(parsed) != TYPE_ARRAY: + push_warning("%s did not contain a JSON array." % PATH) + return [] + + return parsed diff --git a/scripts/Levels.gd.uid b/scripts/Levels.gd.uid new file mode 100644 index 0000000..66faf0d --- /dev/null +++ b/scripts/Levels.gd.uid @@ -0,0 +1 @@ +uid://jdav4er14387 diff --git a/scripts/Main.gd b/scripts/Main.gd new file mode 100644 index 0000000..467b4fe --- /dev/null +++ b/scripts/Main.gd @@ -0,0 +1,69 @@ +extends Control + +const HomeScene = preload("res://scenes/Home.tscn") +const GameScene = preload("res://scenes/Game.tscn") + +var home +var game +var screens := {} +var current := "home" +var nav_stack: Array[String] = [] + + +func _ready() -> void: + var background := ColorRect.new() + background.color = Palette.CREAM + background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + background.mouse_filter = Control.MOUSE_FILTER_IGNORE + add_child(background) + + home = HomeScene.instantiate() + _add_screen(home) + home.play_pressed.connect(_on_play) + + game = GameScene.instantiate() + _add_screen(game) + game.back_pressed.connect(go_back) + + screens = { + "home": home, + "game": game, + } + + show_screen("home", false) + + +func _add_screen(screen: Control) -> void: + add_child(screen) + screen.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + screen.visible = false + + +func show_screen(name: String, push: bool = true) -> void: + if not screens.has(name): + return + if name == current: + screens[name].visible = true + return + if push: + nav_stack.append(current) + + for key in screens: + screens[key].visible = key == name + + current = name + + +func go_back() -> void: + if nav_stack.is_empty(): + show_screen("home", false) + return + var previous: String = nav_stack.pop_back() + show_screen(previous, false) + + +func _on_play() -> void: + var max_index: int = max(0, game.levels.size() - 1) + var start_index: int = clampi(int(SaveGame.data.get("last_room", 0)), 0, max_index) + show_screen("game") + game.start_level(start_index) diff --git a/scripts/Main.gd.uid b/scripts/Main.gd.uid new file mode 100644 index 0000000..b4b34aa --- /dev/null +++ b/scripts/Main.gd.uid @@ -0,0 +1 @@ +uid://ce2ilx6ykee2o diff --git a/scripts/Palette.gd b/scripts/Palette.gd new file mode 100644 index 0000000..2bfe5ed --- /dev/null +++ b/scripts/Palette.gd @@ -0,0 +1,28 @@ +class_name Palette +extends RefCounted + +## One place for every colour in the game. +## The region colours are deliberately mid-light so the dark rats read on top. + +const CREAM := Color("fbf1df") +const PAPER := Color("f2e0c2") +const PAPER_DARK := Color("e7d0ac") +const INK := Color("4a3528") +const MUTED := Color("8c7460") +const WALL := Color("6e5039") +const GRID := Color(0.43, 0.31, 0.22, 0.16) +const GOLD := Color("e7b45c") +const ROSE := Color("d98c86") +const RED := Color("c65b4e") +const WHITE := Color("fffaf0") + +const REGION_COLORS = [ + Color("e9a66b"), # apricot + Color("9cc08a"), # sage + Color("e8c96a"), # butter + Color("b4a6d8"), # lilac + Color("8fbfd8"), # sky + Color("e39a94"), # rose + Color("c9a87c"), # sand + Color("93b5a8"), # teal +] diff --git a/scripts/Palette.gd.uid b/scripts/Palette.gd.uid new file mode 100644 index 0000000..8dc1501 --- /dev/null +++ b/scripts/Palette.gd.uid @@ -0,0 +1 @@ +uid://bahobekaonbjx diff --git a/scripts/RatPortrait.gd b/scripts/RatPortrait.gd new file mode 100644 index 0000000..d01c60c --- /dev/null +++ b/scripts/RatPortrait.gd @@ -0,0 +1,101 @@ +class_name RatPortrait +extends Control + +## A hand-drawn-looking placeholder portrait of Crumb. +## If art/crumb.png exists, Home.gd uses that instead. + +var _time := 0.0 + + +func _ready() -> void: + mouse_filter = Control.MOUSE_FILTER_IGNORE + set_process(true) + + +func _process(delta: float) -> void: + _time += delta + queue_redraw() + + +func _draw() -> void: + var s: float = min(size.x, size.y) + if s <= 0.0: + return + + var bob := 0.0 + if not bool(SaveGame.get_setting("reduce_motion")): + bob = sin(_time * 1.6) * s * 0.012 + _draw_crumb(Vector2(size.x * 0.5, size.y * 0.52 + bob), s) + + +func _draw_crumb(o: Vector2, s: float) -> void: + var fur := Color("96704f") + var fur_dark := Color("7d5b3f") + var cream := Color("f7e6c8") + var pink := Color("e3a49b") + var ink := Palette.INK + + # Body and belly + draw_circle(o + Vector2(0.0, 0.22 * s), 0.30 * s, fur_dark) + draw_circle(o + Vector2(0.0, 0.26 * s), 0.20 * s, cream) + + # Apron + var apron := PackedVector2Array([ + o + Vector2(-0.18, 0.14) * s, + o + Vector2(0.18, 0.14) * s, + o + Vector2(0.24, 0.43) * s, + o + Vector2(-0.24, 0.43) * s, + ]) + draw_colored_polygon(apron, Palette.PAPER) + draw_polyline(PackedVector2Array([apron[0], apron[1], apron[2], apron[3], apron[0]]), Palette.PAPER_DARK, 1.5, true) + + # Cheese pocket + var cheese := PackedVector2Array([ + o + Vector2(0.08, 0.22) * s, + o + Vector2(0.17, 0.22) * s, + o + Vector2(0.15, 0.29) * s, + o + Vector2(0.09, 0.29) * s, + ]) + draw_colored_polygon(cheese, Palette.GOLD) + draw_circle(o + Vector2(0.115, 0.25) * s, 0.012 * s, Palette.PAPER) + + # Ears + for side in [-1.0, 1.0]: + var ear := o + Vector2(0.21 * side, -0.19) * s + draw_circle(ear, 0.16 * s, fur) + draw_circle(ear, 0.105 * s, pink) + + # Head + draw_circle(o + Vector2(0.0, -0.03 * s), 0.235 * s, fur) + + # Cheeks + draw_circle(o + Vector2(-0.14, 0.04) * s, 0.055 * s, Color(0.86, 0.52, 0.48, 0.35)) + draw_circle(o + Vector2(0.14, 0.04) * s, 0.055 * s, Color(0.86, 0.52, 0.48, 0.35)) + + # Muzzle + draw_circle(o + Vector2(0.0, 0.07 * s), 0.135 * s, cream) + + # Eyes + for side in [-1.0, 1.0]: + var eye := o + Vector2(0.085 * side, -0.06) * s + draw_circle(eye, 0.028 * s, ink) + draw_circle(eye + Vector2(0.009, -0.009) * s, 0.009 * s, Palette.WHITE) + + # Nose + draw_circle(o + Vector2(0.0, 0.055 * s), 0.022 * s, Color("c9736b")) + + # Smile + draw_arc(o + Vector2(0.0, 0.075 * s), 0.045 * s, 0.25, PI - 0.25, 16, ink, 2.0, true) + + # Whiskers + var whisker := Color(0.29, 0.20, 0.14, 0.45) + for side in [-1.0, 1.0]: + for i in range(3): + var y := 0.045 + i * 0.035 + draw_line( + o + Vector2(0.06 * side, 0.075) * s, + o + Vector2(0.31 * side, y) * s, + whisker, + 1.5, + true + ) diff --git a/scripts/RatPortrait.gd.uid b/scripts/RatPortrait.gd.uid new file mode 100644 index 0000000..539b8ea --- /dev/null +++ b/scripts/RatPortrait.gd.uid @@ -0,0 +1 @@ +uid://id1oynpdnp3w diff --git a/scripts/Rules.gd b/scripts/Rules.gd new file mode 100644 index 0000000..e108e43 --- /dev/null +++ b/scripts/Rules.gd @@ -0,0 +1,79 @@ +class_name Rules +extends RefCounted + +## Pure rules. No scene, no drawing, no input. +## Keeping this separate means the generator can use the same logic later. + +const EMPTY := 0 +const X := 1 +const RAT := 2 + + +## True when the board is a complete, legal solution: +## one rat per row, column and region, and no two rats touching (even diagonally). +static func is_valid(cells: Array, regions: Array) -> bool: + var n := cells.size() + var rats: Array[Vector2i] = [] + + for r in n: + for c in n: + if int(cells[r][c]) == RAT: + rats.append(Vector2i(r, c)) + + if rats.size() != n: + return false + + var rows := {} + var cols := {} + var used_regions := {} + + for p in rats: + var region := int(regions[p.x][p.y]) + if rows.has(p.x) or cols.has(p.y) or used_regions.has(region): + return false + rows[p.x] = true + cols[p.y] = true + used_regions[region] = true + + for i in rats.size(): + for j in range(i + 1, rats.size()): + var a: Vector2i = rats[i] + var b: Vector2i = rats[j] + if abs(a.x - b.x) <= 1 and abs(a.y - b.y) <= 1: + return false + + return true + + +## Every rat that currently breaks a rule. Used for the soft red ring, +## never to block a move — a cozy game should let you be wrong. +static func conflicts(cells: Array, regions: Array) -> Array: + var n := cells.size() + var bad := {} + + for r in n: + for c in n: + if int(cells[r][c]) != RAT: + continue + for rr in n: + for cc in n: + if rr == r and cc == c: + continue + if int(cells[rr][cc]) != RAT: + continue + var same_region: bool = int(regions[rr][cc]) == int(regions[r][c]) + var touching: bool = abs(rr - r) <= 1 and abs(cc - c) <= 1 + if rr == r or cc == c or same_region or touching: + bad[Vector2i(r, c)] = true + bad[Vector2i(rr, cc)] = true + + return bad.keys() + + +static func count_rats(cells: Array) -> int: + var total := 0 + for r in cells.size(): + for c in cells[r].size(): + if int(cells[r][c]) == RAT: + total += 1 + return total diff --git a/scripts/Rules.gd.uid b/scripts/Rules.gd.uid new file mode 100644 index 0000000..0579b5a --- /dev/null +++ b/scripts/Rules.gd.uid @@ -0,0 +1 @@ +uid://db7t2xjh0jqts diff --git a/scripts/SaveGame.gd b/scripts/SaveGame.gd new file mode 100644 index 0000000..5606daa --- /dev/null +++ b/scripts/SaveGame.gd @@ -0,0 +1,119 @@ +extends Node + +## Persistent settings and room progress. +## Autoloaded as `SaveGame` (see project.godot). + +signal settings_changed +signal progress_changed + +const PATH := "user://ratdoku_save.json" + +const DEFAULTS := { + "patterns": true, + "show_timer": true, + "reduce_motion": false, + "hold_seconds": 0.35, +} + +var data := {} + + +func _ready() -> void: + load_game() + + +func _default_data() -> Dictionary: + return { + "version": 1, + "completed_rooms": [], + "unlocked_guests": [], + "settings": DEFAULTS.duplicate(true), + "last_room": 0, + } + + +func load_game() -> void: + data = _default_data() + + if FileAccess.file_exists(PATH): + var file := FileAccess.open(PATH, FileAccess.READ) + if file != null: + var parsed = JSON.parse_string(file.get_as_text()) + file.close() + if typeof(parsed) == TYPE_DICTIONARY: + for key in parsed: + data[key] = parsed[key] + + if typeof(data.get("settings")) != TYPE_DICTIONARY: + data["settings"] = DEFAULTS.duplicate(true) + for key in DEFAULTS: + if not data["settings"].has(key): + data["settings"][key] = DEFAULTS[key] + + if typeof(data.get("completed_rooms")) != TYPE_ARRAY: + data["completed_rooms"] = [] + if typeof(data.get("unlocked_guests")) != TYPE_ARRAY: + data["unlocked_guests"] = [] + + +func save_game() -> void: + var file := FileAccess.open(PATH, FileAccess.WRITE) + if file == null: + return + file.store_string(JSON.stringify(data, "\t")) + file.close() + + +func get_setting(key: String): + return data["settings"].get(key, DEFAULTS.get(key)) + + +func set_setting(key: String, value) -> void: + data["settings"][key] = value + save_game() + settings_changed.emit() + + +func is_guest_unlocked(id: String) -> bool: + var guest := Guests.by_id(id) + if guest.is_empty(): + return false + if int(guest.get("unlock_room", 0)) == 0: + return true + return data["unlocked_guests"].has(id) + + +func complete_room(room_id: String, room_number: int) -> String: + if not data["completed_rooms"].has(room_id): + data["completed_rooms"].append(room_id) + + var last: int = max(int(data.get("last_room", 0)), room_number) + data["last_room"] = last + + var unlocked := "" + var guest := Guests.for_room(room_number) + if not guest.is_empty(): + var id := str(guest["id"]) + if not data["unlocked_guests"].has(id): + data["unlocked_guests"].append(id) + unlocked = id + + save_game() + progress_changed.emit() + return unlocked + + +func reset_progress() -> void: + data["completed_rooms"] = [] + data["unlocked_guests"] = [] + data["last_room"] = 0 + save_game() + progress_changed.emit() + + +func unlocked_count(guests: Array) -> int: + var total := 0 + for guest in guests: + if is_guest_unlocked(str(guest["id"])): + total += 1 + return total diff --git a/scripts/SaveGame.gd.uid b/scripts/SaveGame.gd.uid new file mode 100644 index 0000000..a949cd6 --- /dev/null +++ b/scripts/SaveGame.gd.uid @@ -0,0 +1 @@ +uid://dthb1aaqsrgdf diff --git a/scripts/UI.gd b/scripts/UI.gd new file mode 100644 index 0000000..14d0ceb --- /dev/null +++ b/scripts/UI.gd @@ -0,0 +1,68 @@ +class_name UI +extends RefCounted + +## Small helpers so the screens stay readable. +## Every control is built in code for now; we can move to .tscn layouts later. + +static func label(text: String, font_size: int, color: Color = Palette.INK) -> Label: + var l := Label.new() + l.text = text + l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER + l.vertical_alignment = VERTICAL_ALIGNMENT_CENTER + l.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART + l.add_theme_font_size_override("font_size", font_size) + l.add_theme_color_override("font_color", color) + return l + + +static func button(text: String, primary: bool = false, min_height: int = 58) -> Button: + var b := Button.new() + b.text = text + b.custom_minimum_size = Vector2(0, min_height) + b.add_theme_font_size_override("font_size", 22) + b.add_theme_color_override("font_color", Palette.INK) + b.add_theme_color_override("font_hover_color", Palette.INK) + b.add_theme_color_override("font_pressed_color", Palette.INK) + b.add_theme_color_override("font_focus_color", Palette.INK) + b.add_theme_stylebox_override("normal", _button_style(Palette.GOLD if primary else Palette.PAPER)) + b.add_theme_stylebox_override("hover", _button_style((Palette.GOLD if primary else Palette.PAPER).lightened(0.05))) + b.add_theme_stylebox_override("pressed", _button_style((Palette.GOLD if primary else Palette.PAPER).darkened(0.07))) + b.add_theme_stylebox_override("focus", _button_style((Palette.GOLD if primary else Palette.PAPER).lightened(0.05))) + b.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND + return b + + +static func panel(color: Color = Palette.PAPER, radius: int = 28, margin: int = 24) -> PanelContainer: + var p := PanelContainer.new() + var s := StyleBoxFlat.new() + s.bg_color = color + s.corner_radius_top_left = radius + s.corner_radius_top_right = radius + s.corner_radius_bottom_left = radius + s.corner_radius_bottom_right = radius + s.content_margin_left = margin + s.content_margin_right = margin + s.content_margin_top = margin + s.content_margin_bottom = margin + s.shadow_color = Color(0.29, 0.20, 0.14, 0.12) + s.shadow_size = 6 + s.shadow_offset = Vector2(0, 4) + p.add_theme_stylebox_override("panel", s) + return p + + +static func _button_style(color: Color) -> StyleBoxFlat: + var s := StyleBoxFlat.new() + s.bg_color = color + s.corner_radius_top_left = 18 + s.corner_radius_top_right = 18 + s.corner_radius_bottom_left = 18 + s.corner_radius_bottom_right = 18 + s.content_margin_left = 18 + s.content_margin_right = 18 + s.content_margin_top = 10 + s.content_margin_bottom = 10 + s.shadow_color = Color(0.29, 0.20, 0.14, 0.14) + s.shadow_size = 4 + s.shadow_offset = Vector2(0, 3) + return s diff --git a/scripts/UI.gd.uid b/scripts/UI.gd.uid new file mode 100644 index 0000000..50e9557 --- /dev/null +++ b/scripts/UI.gd.uid @@ -0,0 +1 @@ +uid://duw4p0atxn4du