Commit a224d343
a224d343e9beMergedon cedricvidal-66f663
cedricvidal · 2 months ago · 3 files · +1 added · ~2 modified
Details
- Commit
- a224d343e9be
- Parent
- 866d43068504
README.mdaddedView file
1+
# Rubik's Cube 3D2+
3+
A 3D Rubik's Cube game built with TypeScript, Vite, and Three.js.4+
5+
## Run6+
7+
```bash8+
npm install9+
npm run dev # dev server at http://localhost:517310+
npm run build # type-check + production build to dist/11+
```12+
13+
## How to play14+
15+
- **Drag a sticker** to turn its layer (middle layers work too).16+
- **Drag the background** to orbit the camera; scroll to zoom.17+
- **Keyboard**: `U D L R F B` turn faces clockwise; hold `Shift` for18+
counter-clockwise (standard cube notation).19+
- **Scramble** starts a timed game with a move counter; solve the cube to20+
stop the clock.21+
- **Reset** returns the cube to the solved state.22+
23+
## Code layout24+
25+
| File | Role |26+
| --- | --- |27+
| `src/cube.ts` | Builds the 26 cubie meshes with sticker materials |28+
| `src/rubiks.ts` | Move queue, animated 90° layer turns, scramble, solved detection |29+
| `src/dragControls.ts` | Raycast-based drag-to-turn pointer input |30+
| `src/scene.ts` | Renderer, camera, lights, resize handling |31+
| `src/main.ts` | Game state (idle / scrambling / playing), HUD, keyboard input |index.htmlmodifiedView file
Loading diff…
src/main.tsmodifiedView file
Loading diff…