v0.1.0-alpha: first playable
20 rooms, Crumb board token, Home and Game screens only.
No files matched your search
@@ -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/*/
|
||||
@@ -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.
|
||||
@@ -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}/<id>.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
|
||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 464 KiB |
|
After Width: | Height: | Size: 478 KiB |
|
After Width: | Height: | Size: 429 KiB |
|
After Width: | Height: | Size: 431 KiB |
|
After Width: | Height: | Size: 487 KiB |
|
After Width: | Height: | Size: 485 KiB |
|
After Width: | Height: | Size: 481 KiB |
|
After Width: | Height: | Size: 453 KiB |
|
After Width: | Height: | Size: 472 KiB |
|
After Width: | Height: | Size: 450 KiB |
|
After Width: | Height: | Size: 401 KiB |
|
After Width: | Height: | Size: 441 KiB |
|
After Width: | Height: | Size: 473 KiB |
|
After Width: | Height: | Size: 390 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 503 KiB |
|
After Width: | Height: | Size: 460 KiB |
|
After Width: | Height: | Size: 487 KiB |
|
After Width: | Height: | Size: 447 KiB |
|
After Width: | Height: | Size: 505 KiB |
|
After Width: | Height: | Size: 495 KiB |
|
After Width: | Height: | Size: 469 KiB |
|
After Width: | Height: | Size: 459 KiB |
|
After Width: | Height: | Size: 478 KiB |
|
After Width: | Height: | Size: 505 KiB |
|
After Width: | Height: | Size: 474 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 129 KiB |
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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]]
|
||||
}
|
||||
@@ -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()
|
||||
|
After Width: | Height: | Size: 68 KiB |
@@ -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
|
||||
@@ -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")
|
||||
@@ -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")
|
||||
@@ -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")
|
||||
@@ -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")
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://crr3c5broksxt
|
||||
@@ -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()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cenbkgbgqff87
|
||||
@@ -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]
|
||||
@@ -0,0 +1 @@
|
||||
uid://tmawomp3s1s
|
||||
@@ -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()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bvt3jm3kpjs3x
|
||||
@@ -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
|
||||