File size: 2,737 Bytes
e5f2822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Troubleshooting Guide

## Common Issues

### Game doesn't load / Black screen

1. **Check browser console** (F12) for errors
2. **Verify assets are generated**:
   ```bash
   npm run generate-assets
   ```
3. **Clear browser cache** and reload (Cmd+Shift+R or Ctrl+Shift+R)

### Audio doesn't play

- **Browser autoplay policy**: Most browsers block audio until user interaction
- The game requires you to press SPACE to start, which should enable audio
- Check browser console for audio-related errors
- Verify music files exist in `public/assets/music/level-X/track.mp3`

### Blocks don't appear or wrong colors

- **Color extraction issue**: Make sure backdrop images are valid PNG files
- **Texture generation**: Check browser console for WebGL errors
- Try refreshing the page

### Controls not working

- Make sure the game window has focus (click on it)
- Check that you're using arrow keys and spacebar
- Verify no browser extensions are intercepting keyboard events

### Performance issues

- The game uses pixel-perfect rendering which is GPU-intensive
- Try closing other browser tabs
- Check if hardware acceleration is enabled in browser settings

## Development Issues

### Canvas module installation fails

If `npm install canvas` fails on your system:

1. The placeholder generation will skip backdrop creation
2. You can manually create 256×224 PNG files and place them in:
   ```
   public/assets/backdrops/level-X/backdrop.png
   ```

### Vite build errors

- Make sure you're using Node.js version 14 or higher
- Delete `node_modules` and `package-lock.json`, then run `npm install` again

### Module import errors

- Verify `"type": "module"` is in package.json
- Check that all import paths use `.js` extensions

## Testing Checklist

- [ ] Game loads and shows "LOADING..." then "PRESS SPACE TO START"
- [ ] Pressing SPACE starts the game
- [ ] Backdrop is visible
- [ ] Tetris pieces appear and are colored
- [ ] Arrow keys move pieces left/right
- [ ] Up arrow rotates pieces
- [ ] Down arrow soft drops
- [ ] Space bar hard drops
- [ ] Lines clear when complete
- [ ] Score updates
- [ ] Level increases after 20 lines
- [ ] Backdrop, music, and colors change on level up
- [ ] Ghost piece shows on level 1 only
- [ ] Game over screen appears when pieces stack to top

## Browser Compatibility

Tested on:
- Chrome/Edge (recommended)
- Firefox
- Safari

Requires:
- WebGL support
- ES6 module support
- Web Audio API

## Getting Help

If you encounter issues:

1. Check the browser console (F12) for error messages
2. Verify all files are in the correct locations
3. Make sure the dev server is running (`npm run dev`)
4. Try a different browser
5. Check that all dependencies are installed (`npm install`)