# ButterPan
Runs one pan of Butter Up on the entity it sits on (the pan's pivot: the centre
of its inner floor). It reads the tilt (the pointer's place over the screen, or
the `tilt` control from keys, pad or touch), eases the pan toward it, steps the
butter simulation (`butterUp.panSim`), moves, squashes and shrinks the `pat` and
its `skirt` (children of the pivot), and draws the coating with a live texture
on a glaze mesh it makes under the pivot.
When the pan is fully coated it fires `panDone` (seconds taken, pats used, the
share of the last pat left, whether a golden pat finished it), sweeps a shine
across the butter, wipes the pan and drops the next pat.
`setStats(stats)` replaces the numbers the pan plays by (see `panSim`'s
`Stats`, plus `maxTilt` in degrees, `tiltResponse` in seconds and
`goldenChance` 0..1); it takes effect from the next pat.
# pans
The ladder of pans in Butter Up: a round carbon-steel skillet, a square cast-iron pan, an oval non-stick fish pan, a rectangular copper pan and a big round gilded pan. Each entry has its name, its floor outline (`a`, `b`, `n`: half-length toward the handle, half-width and corner exponent of a superellipse), heat evenness, base value per coated pan, par time and price. `HANDLE_YAW` is the handle's direction and `shapeStats(pan)` gives the shape fields the simulation takes. Read by the pan (shape, heat), the scene build (each pan's model is swept round its outline) and the economy (pay, shop).
# panSim
The Butter Up pan simulation, with no engine calls: a pat of butter sliding on a
tilted pan floor, melting by a heat map, and stamping what melts into a coverage
grid that counts how much of the pan is coated.
```luau
local PanSim = require("butterUp.panSim")
local sim = PanSim.new(PanSim.defaultStats())
sim:dropPat(0, 0)
sim:step(1/60, gx, gz) -- gx, gz: gravity along the floor (m/s^2), from the pan's tilt
print(sim.coverage) -- 0..1
```
Floor frame: x and z in metres, origin at the pan's centre. The floor is a
superellipse `|u/a|^n + |v/b|^n <= 1` in a frame turned by `stats.shapeYaw`
(u toward the handle): `shapeA` and `shapeB` are its half-length and half-width,
`shapeN` its corner exponent (2 = round or oval, about 5 = a softly rounded
square or rectangle). With no shape fields it is a disc of `stats.panRadius`.
`sim:outline(x, z)` answers 1 on the edge and under 1 inside, `sim:normalAt`
the wall's outward normal, `sim:boundaryAt(phi)` a point on the edge, and
`PanSim.extent(stats)` the farthest the floor reaches from the centre. The
wall pushes the pat back along its normal, the rim bead runs along the
outline, and the burner's hot ring stays round (sized by `sqrt(a*b)`), so the
long ends of an oval or rectangle run cooler.
The grid is `N x N` cells over the square of half-width `gridRadius` (the
floor's extent plus a margin, so a smear reaches the wall); a cell counts
toward coverage when its centre is on the floor. `coat[i]` runs 0..2
(1 = fully coated, above 1 = pooled); `fresh[i]` is 1 when butter has just been
laid there and decays. `dirty` is set whenever the grid changes.
# hud
Butter Up's on-screen interface: the coverage meter and butter gauge over the
pan, and the first-run hint. `Hud.show()` registers and shows the `butterHud`
screen; `Hud.set(state)` updates it (call it a few times a second, it only
rebuilds when a shown value changed).
`state`: `{ coverage = 0..1, butterLeft = 0..1, hint = string?, golden = bool }`.
# title
Butter Up's title screen. `ButterPan` shows it when play starts, over the live kitchen (the pan sits on the flame behind a warm vignette): a melting-pat badge, the BUTTER UP wordmark, a one-line pitch and a large gold Play button that reads Continue when the save has progress. The button takes focus, so a click, a tap, Enter, Space or the pad's confirm all start the game. While the title is up the first pat waits, the pan ignores input and the game HUD stays hidden; Play fades the title out, brings the HUD in and drops the first pat.
- `Title.show(play)`: show it; `play` runs when the player starts.
- `Title.isUp()`: whether it is in front of the game.
- `Title.relayout()`: lay it out again after the screen changes shape (phone turned, window resized).
- `Title.play()`: start as if Play were pressed.
The layout reads the canvas: narrow screens (under 600 px wide) and short ones (under 500 px tall) get a smaller wordmark and button. Every animation stands still under reduced motion.
# Butter Up
The whole game Butter Up as one package. A pat of butter lands in a hot skillet, you tilt the pan, and it slides, sizzles and melts into a glossy golden film. Coat every bit of the floor and the pan pays out. The coins buy hotter burners, bigger pats, wider smears, steadier wrists, premium butter, lucky golden pats, a Kitchen Helper that steers the pan for you, Line Cooks who earn while you are away, and a ladder of five pans: round carbon steel, square cast iron, an oval non-stick fish pan, rectangular copper and gilded. Opening a restaurant resets the run for Chef Stars and permanent perks.
## Play it in another world
Install the package, load its `kitchen` scene, and make it the world's startup scene (`scene.setStartup`). It brings the Pan Cooking Kit (the pan, butter physics, film and effects) and the Incremental Kit (shop, prestige, saves) with it. Forking the Butter Up world gives you the same game as a world of your own.
## See it
The Butter Up world page has a gameplay trailer, an upright-phone clip with touch drag, and a showcase of the Pan Cooking Kit's four looks.
## What is in it
- **`kitchen` scene:** the warm kitchen, with a range, a window of morning sun, scanned and hand-modelled props, the five pans (built with the kit's `CookingPanModel`) and the fixed cook's camera.
- **`ButterPan`:** the game's pan. It drives the Pan Cooking Kit's simulation, film and tilt input, and adds the title, HUD, helper hand-off, the pan swap between tiers, and camera framing for desktop and upright phones.
- **`ButterEconomy`:** the shop, upgrades, Line Cooks, Kitchen Helper, golden pats, milestones and prestige, on the Incremental Kit.
- **`ButterFx`:** sizzle, music, spits, foam, steam, the pay-out sparkle and the camera's push-in.
- **`pans`:** the pan ladder, each pan's outline, heat evenness, value and price.
- **`title`, `hud`, `pauseMenu`:** the title screen, the coverage meter, and the pause menu with tilt sensitivity, invert and volume settings.
# Pan Cooking Kit
Tilt a hot frying pan so a pat of butter slides, wobbles, melts and glazes the floor gold, in any world and in four looks. It is the cooking core of the game Butter Up, published so any game can have it: a cooking minigame, a kitchen sim, a cozy idle game, a toon diner or a retro arcade cabinet.
## What you get
- **A pan you tilt** with the mouse (the pan leans toward the pointer), a touch drag anywhere (a floating stick), WASD or the arrows, or a gamepad stick, springing smoothly toward your hands.
- **Butter physics:** a pat with mass and friction slides downhill, wobbles as it changes direction, rides up the curved wall, and melts by the burner's heat ring (faster when it moves and on a hotter burner). It leaves a film that runs downhill and pools, and a bead runs along a hot wall. A coverage meter counts every cell of the floor, and the last bare spots glow near the end.
- **Four pan shapes:** round, square, oval and rectangle, from one outline that the physics, the film and the model share, so the butter coats exactly the floor you see. Oval and rectangular pans reach past the round burner's heat, so their ends run cooler.
- **Five finishes:** carbon steel, cast iron (with a hanging loop and a helper lug), non-stick, copper and gilded.
- **Four styles:**
- `realistic`: glossy translucent butter with window glints, on real metals.
- `toon`: flat cel bands, an ink line and one hard highlight, on bright matte pans.
- `pastel`: creamy butter and a gentle sheen, on candy enamel.
- `pixel`: chunky square cells of flat colour, on pans built from voxels with stepped walls.
- **Cooking effects:** a sizzle loop that follows the melt, spits, foam and steam off the pat, a splash and thud when a pat lands, and a sparkle and chime when the pan is coated, tinted by the style.
## See it
The Butter Up world page (origozero.ai/world/lumi/butter-up) has three clips of the kit at work:
- **Styles showcase:** all four looks side by side, cooking at once, as in the kit's `styleShowcase` scene. Front left is realistic (oval copper), front right toon (square non-stick), back left pastel (round non-stick) and back right pixel (a voxel rectangle in carbon steel).
- **Gameplay trailer:** the realistic look in a full game, from the first pat to a coated pan, the pay-out and the shop.
- **Phone clip:** touch drag tilting the pan on an upright phone screen.
## Use it
Place a playable pan from a scene's `build.luau`:
```luau
-- `position` is the surface it stands on: the pan rides on a cast-iron
-- stand tall enough to tilt clear of it (params.stand = false leaves it off)
asset.resolve("panCooking.pan", "sceneModule"):instantiate(nil, {
name = "myPan", position = { 0, 0.9, 0 },
params = { shape = "square", finish = "castIron", style = "toon" },
})
```
Then listen for the pan being coated, and pay the player:
```luau
-- TiltPan lives on the placed pan's `cookingPan` entity, the part that tilts
local pan
for _, c in entity.find("myPan"):getChildren() do
if c.name == "cookingPan" then pan = c.component.get("panCooking.TiltPan") end
end
pan.events.coated:connect(function(e) print("coated in", e.seconds, "s with", e.patsUsed, "pats") end)
pan.burner = 1.5 -- an upgrade: every field is live
pan:setStyle("pixel") -- switch the look mid-game
```
Open the kit's `styles` scene to see and play all four styles side by side.
## The parts
| Part | What it is |
|---|---|
| `pan` (scene module) | A complete playable pan in one placement: model, pat, `TiltPan`, `CookingFx`. |
| `TiltPan` (component) | Runs one pan: hands, physics, film, pats, coated-pan loop, events. |
| `CookingFx` (component) | Sizzle, spits, foam, steam, splash and sparkle for a pan. |
| `panSim` (module) | The butter physics and coverage grid, with no engine calls. |
| `panShape` (module) | Shape presets, outline maths and the pan body sweep. |
| `panModel` (module) | `CookingPanModel`, `CookingPatModel` and `CookingMeltModel` build nouns. |
| `coat` (module) | The butter film: mesh, two glaze passes and texture upload. |
| `tiltInput` (module) | Mouse, touch, keys and pad to a springy tilt and floor gravity. |
| `styles` (module) | The four looks, and the shape for your own. |
| `butterGlaze` (shader) | The film's surface shader, with style properties. |
| `cookingFx` (effect) | The particle entries. |
| `tilt` (input map) | WASD, arrows and the gamepad stick. |
| `audio` | Sizzle loop, thud and chime. |
Each part also works on its own: a game with its own controller can drive `panSim` and draw it with `coat`, which is how Butter Up does it.