-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
1759 lines (1589 loc) · 76.1 KB
/
renderer.js
File metadata and controls
1759 lines (1589 loc) · 76.1 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ════════════════════════════════════════════════════════════════════════════════
// Rendering Module - All canvas drawing functions
// Extracted from game.js to separate rendering logic
// Uses global objects: ctx, canvas, cameraY, player, blocks, zone themes, etc.
// ════════════════════════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════════════════════
// SCANLINE CACHE (Performance Optimization)
// ═══════════════════════════════════════════════════════════════════════════════
let scanlineCache = null;
function createScanlineCache() {
const scanlineCanvas = document.createElement('canvas');
scanlineCanvas.width = CANVAS_LOGICAL_W;
scanlineCanvas.height = CANVAS_LOGICAL_H;
const scanlineCtx = scanlineCanvas.getContext('2d');
// Pre-render scanlines to offscreen canvas
scanlineCtx.strokeStyle = 'rgba(0, 0, 0, 0.03)';
scanlineCtx.lineWidth = 1;
for (let i = 0; i < CANVAS_LOGICAL_H; i += 4) {
scanlineCtx.beginPath();
scanlineCtx.moveTo(0, i);
scanlineCtx.lineTo(CANVAS_LOGICAL_W, i);
scanlineCtx.stroke();
}
return scanlineCanvas;
}
// Deferred: scanlineCache is created after canvas is ready (called from game.js init)
// ═══════════════════════════════════════════════════════════════════════════════
// ITEM RENDERING
// ═══════════════════════════════════════════════════════════════════════════════
// ─── 아이템 렌더링 ───
function drawItems() {
for (const item of items) {
if (item.collected) continue;
const screenY = item.y + cameraY + Math.sin(item.bobPhase) * 4;
if (screenY < -40 || screenY > canvas.height + 40) continue;
const cx = item.x + item.width / 2;
const cy = screenY + item.height / 2;
const glow = 8 + Math.sin(item.glowPhase) * 5;
// 글로우 효과 (shadowBlur 대신 반투명 원으로 대체 - 성능 최적화)
ctx.globalAlpha = 0.25;
ctx.fillStyle = item.color;
ctx.beginPath();
ctx.arc(cx, cy, 14 + glow * 0.5, 0, Math.PI * 2);
ctx.fill();
ctx.globalAlpha = 1;
// 원형 배경
ctx.fillStyle = 'rgba(0,0,0,0.55)';
ctx.beginPath();
ctx.arc(cx, cy, 14, 0, Math.PI * 2);
ctx.fill();
// 색상 테두리
ctx.strokeStyle = item.color;
ctx.lineWidth = 2;
ctx.beginPath();
ctx.arc(cx, cy, 14, 0, Math.PI * 2);
ctx.stroke();
// 글리프
ctx.fillStyle = '#ffffff';
ctx.font = 'bold 9px monospace';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(item.glyph, cx, cy);
ctx.textAlign = 'left';
ctx.textBaseline = 'alphabetic';
}
}
// ─── 파워업 HUD ───
function drawPowerupHUD() {
let hudY = 110;
const hudX = 8;
ctx.font = '10px monospace';
ctx.textBaseline = 'middle';
const actives = [];
if (powerups.doubleJump.active) actives.push({ label: '2x JUMP', color: '#ffdd00', t: powerups.doubleJump.timer, max: 600 });
if (powerups.speedBoost.active) actives.push({ label: 'SPEED', color: '#ff6600', t: powerups.speedBoost.timer, max: 420 });
if (powerups.shield.active) actives.push({ label: 'SHIELD', color: '#4488ff', t: -1, max: 1 });
if (powerups.slowMotion.active) actives.push({ label: 'SLOW', color: '#cc44ff', t: powerups.slowMotion.timer, max: 300 });
for (const p of actives) {
ctx.fillStyle = 'rgba(0,0,0,0.6)';
ctx.fillRect(hudX, hudY - 9, 72, 18);
const ratio = p.t < 0 ? 1.0 : p.t / p.max;
ctx.fillStyle = p.color;
ctx.globalAlpha = 0.35;
ctx.fillRect(hudX, hudY - 9, 72 * ratio, 18);
ctx.globalAlpha = 1;
ctx.fillStyle = p.color;
const secStr = p.t > 0 ? ' ' + Math.ceil(p.t / 60) + 's' : '';
ctx.fillText(p.label + secStr, hudX + 4, hudY);
hudY += 22;
}
ctx.textBaseline = 'alphabetic';
}
// ═══════════════════════════════════════════════════════════════════════════════
// PIXEL ART HELPER FUNCTIONS
// ═══════════════════════════════════════════════════════════════════════════════
// ===== PIXEL ART HELPER FUNCTIONS =====
function drawPixel(x, y, color, size) {
ctx.fillStyle = color;
ctx.fillRect(x, y, size, size);
}
function drawPixelArt(baseX, baseY, pixelSize, spriteData) {
for (let row = 0; row < spriteData.length; row++) {
for (let col = 0; col < spriteData[row].length; col++) {
if (spriteData[row][col]) {
ctx.fillStyle = spriteData[row][col];
ctx.fillRect(baseX + col * pixelSize, baseY + row * pixelSize, pixelSize, pixelSize);
}
}
}
}
// Get scare level based on zone
function getScareLevel() {
const zone = getCurrentZone();
if (zone <= 1) return 0; // Normal
if (zone <= 3) return 1; // Scared
if (zone <= 6) return 2; // Very scared
return 3; // Terrified
}
// ═══════════════════════════════════════════════════════════════════════════════
// CHARACTER DRAWING FUNCTIONS (PIXEL ART)
// ═══════════════════════════════════════════════════════════════════════════════
// ===== HUMAN CHARACTER (PIXEL ART) =====
function drawHuman(screenY) {
const scareLevel = getScareLevel();
const pixelSize = 2;
const baseX = player.x;
const baseY = screenY;
const dir = player.facingRight ? 1 : -1;
// Simplified pixel art human (15x20 pixels = 30x40 on screen)
// Hair
drawPixel(baseX + 3*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 4*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 6*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 11*pixelSize, baseY + 0*pixelSize, '#3a2a1a', pixelSize);
// Hair second row
drawPixel(baseX + 2*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 3*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 4*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 1*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 6*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 1*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 11*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
drawPixel(baseX + 12*pixelSize, baseY + 1*pixelSize, '#3a2a1a', pixelSize);
// Face - skin tone (lighter)
drawPixel(baseX + 3*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 4*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 6*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 11*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 12*pixelSize, baseY + 2*pixelSize, '#d4a574', pixelSize);
// Face row 2
for (let i = 3; i < 13; i++) {
drawPixel(baseX + i*pixelSize, baseY + 3*pixelSize, '#d4a574', pixelSize);
}
// Eyes - based on scare level and blinking
if (!player.isBlinking) {
if (scareLevel === 0) {
// Normal eyes - closed/neutral
drawPixel(baseX + 5*pixelSize, baseY + 3*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 3*pixelSize, '#1a1a1a', pixelSize);
} else if (scareLevel <= 1) {
// Slightly scared - small pupils
drawPixel(baseX + 5*pixelSize, baseY + 3*pixelSize, '#ffffff', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 3*pixelSize, '#ffffff', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 4*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 4*pixelSize, '#1a1a1a', pixelSize);
} else {
// Very scared - wide eyes
drawPixel(baseX + 4*pixelSize, baseY + 3*pixelSize, '#ffffff', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 3*pixelSize, '#ffffff', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 3*pixelSize, '#ffffff', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 3*pixelSize, '#ffffff', pixelSize);
drawPixel(baseX + 4*pixelSize, baseY + 4*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 4*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 4*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 4*pixelSize, '#1a1a1a', pixelSize);
}
}
// Mouth - based on scare level
if (scareLevel === 0) {
// Normal - line
drawPixel(baseX + 5*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 6*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
} else if (scareLevel === 1) {
// Worried - O shape
drawPixel(baseX + 6*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 6*pixelSize, baseY + 7*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 7*pixelSize, '#8a5a3a', pixelSize);
} else {
// Terrified - open mouth
for (let i = 6; i <= 8; i++) {
drawPixel(baseX + i*pixelSize, baseY + 6*pixelSize, '#8a5a3a', pixelSize);
}
drawPixel(baseX + 6*pixelSize, baseY + 7*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 7*pixelSize, '#8a5a3a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 8*pixelSize, '#8a5a3a', pixelSize);
}
// Jacket - dark green
for (let row = 8; row < 16; row++) {
for (let col = 2; col < 13; col++) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#2a3a2a', pixelSize);
}
}
// Jacket shading (darker on left side for volume)
if (player.facingRight) {
for (let row = 8; row < 12; row++) {
drawPixel(baseX + 2*pixelSize, baseY + row*pixelSize, '#1a2a1a', pixelSize);
}
} else {
for (let row = 8; row < 12; row++) {
drawPixel(baseX + 12*pixelSize, baseY + row*pixelSize, '#1a2a1a', pixelSize);
}
}
// Jacket details - pockets
drawPixel(baseX + 4*pixelSize, baseY + 10*pixelSize, '#1a2a1a', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 10*pixelSize, '#1a2a1a', pixelSize);
// Arms - swing animation
const armSwing = player.isMoving ? Math.sin(player.walkCycle) * 3 : 0;
if (!player.isOnGround) {
// Arms up while jumping
drawPixel(baseX + 1*pixelSize, baseY + 9*pixelSize, '#2a3a2a', pixelSize);
drawPixel(baseX + 13*pixelSize, baseY + 9*pixelSize, '#2a3a2a', pixelSize);
drawPixel(baseX + 0*pixelSize, baseY + 8*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 14*pixelSize, baseY + 8*pixelSize, '#d4a574', pixelSize);
} else {
// Normal arm position with walk swing
drawPixel(baseX + 1*pixelSize, baseY + (11 + armSwing)*pixelSize, '#2a3a2a', pixelSize);
drawPixel(baseX + 13*pixelSize, baseY + (11 - armSwing)*pixelSize, '#2a3a2a', pixelSize);
drawPixel(baseX + 0*pixelSize, baseY + (12 + armSwing)*pixelSize, '#d4a574', pixelSize);
drawPixel(baseX + 14*pixelSize, baseY + (12 - armSwing)*pixelSize, '#d4a574', pixelSize);
}
// Belt buckle - metallic gold
drawPixel(baseX + 6*pixelSize, baseY + 14*pixelSize, '#ffaa00', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 14*pixelSize, '#ffaa00', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 14*pixelSize, '#ffaa00', pixelSize);
// Pants - dark brown
for (let row = 16; row < 19; row++) {
for (let col = 3; col < 12; col++) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#3a3020', pixelSize);
}
}
// Pants shading
if (player.facingRight) {
for (let row = 16; row < 18; row++) {
drawPixel(baseX + 3*pixelSize, baseY + row*pixelSize, '#2a2010', pixelSize);
}
} else {
for (let row = 16; row < 18; row++) {
drawPixel(baseX + 11*pixelSize, baseY + row*pixelSize, '#2a2010', pixelSize);
}
}
// Boots - animated walk cycle
const walkOffset = player.isMoving ? Math.sin(player.walkCycle) * 2 : 0;
drawPixel(baseX + (4 + walkOffset)*pixelSize, baseY + 19*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + (10 - walkOffset)*pixelSize, baseY + 19*pixelSize, '#1a1a1a', pixelSize);
// Walking dust effect
if (player.isOnGround && player.isMoving) {
const walkPhase = Math.sin(player.walkCycle || 0);
if (Math.abs(walkPhase) > 0.8 && Math.random() < 0.3) {
impactParticles.push({
x: baseX + 7*pixelSize,
y: baseY + 20*pixelSize,
vx: (Math.random() - 0.5) * 1,
vy: -Math.random() * 0.5,
size: 1 + Math.random(),
life: 0.5,
decay: 0.05,
color: '#6a5a4a'
});
}
}
}
// ===== SKELETON CHARACTER (PIXEL ART) =====
function drawSkeleton(screenY) {
const scareLevel = getScareLevel();
const pixelSize = 2;
const baseX = player.x;
const baseY = screenY;
// Skull - off white
for (let row = 0; row < 5; row++) {
for (let col = 4; col < 11; col++) {
if ((row === 0 && col > 4 && col < 10) ||
(row === 1 && col > 3 && col < 11) ||
(row === 2 && col > 3 && col < 11) ||
(row === 3 && col > 4 && col < 10) ||
(row === 4 && col === 5 || col === 9)) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#e8e0d0', pixelSize);
}
}
}
// Eyes - dark sockets (with blinking)
if (!player.isBlinking) {
if (scareLevel === 0) {
drawPixel(baseX + 5*pixelSize, baseY + 2*pixelSize, '#1a1a1a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 2*pixelSize, '#1a1a1a', pixelSize);
} else if (scareLevel <= 1) {
drawPixel(baseX + 5*pixelSize, baseY + 2*pixelSize, '#cc6666', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 2*pixelSize, '#cc6666', pixelSize);
} else {
drawPixel(baseX + 4*pixelSize, baseY + 2*pixelSize, '#ff0000', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 2*pixelSize, '#ff0000', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 2*pixelSize, '#ff0000', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 2*pixelSize, '#ff0000', pixelSize);
}
}
// Nose - dark
drawPixel(baseX + 7*pixelSize, baseY + 3*pixelSize, '#1a1a1a', pixelSize);
// Teeth/Jaw - based on scare
const teethY = scareLevel <= 1 ? 4 : 5;
for (let col = 5; col < 10; col++) {
drawPixel(baseX + col*pixelSize, baseY + teethY*pixelSize, '#e8e0d0', pixelSize);
}
// Spine/Ribcage - light grey
drawPixel(baseX + 7*pixelSize, baseY + 6*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 7*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 8*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 9*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 10*pixelSize, '#c0b8a8', pixelSize);
// Ribs
drawPixel(baseX + 5*pixelSize, baseY + 7*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 7*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 9*pixelSize, '#c0b8a8', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 9*pixelSize, '#c0b8a8', pixelSize);
// Arms - bone
drawPixel(baseX + 3*pixelSize, baseY + 7*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 11*pixelSize, baseY + 7*pixelSize, '#e8e0d0', pixelSize);
// Legs - bone
drawPixel(baseX + 5*pixelSize, baseY + 16*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 16*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 17*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 17*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 18*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 18*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 19*pixelSize, '#e8e0d0', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 19*pixelSize, '#e8e0d0', pixelSize);
// Bone cracks - dark lines for damage/detail
drawPixel(baseX + 4*pixelSize, baseY + 1*pixelSize, '#4a3a2a', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 1*pixelSize, '#4a3a2a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 8*pixelSize, '#4a3a2a', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 11*pixelSize, '#4a3a2a', pixelSize);
}
// ===== DOG CHARACTER (PIXEL ART) =====
function drawDog(screenY) {
const scareLevel = getScareLevel();
const pixelSize = 2;
const baseX = player.x;
const baseY = screenY;
// Body - golden brown
for (let row = 8; row < 18; row++) {
for (let col = 3; col < 12; col++) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#c4a050', pixelSize);
}
}
// Body shading (darker side for volume)
if (player.facingRight) {
for (let row = 8; row < 16; row++) {
drawPixel(baseX + 3*pixelSize, baseY + row*pixelSize, '#a08030', pixelSize);
}
} else {
for (let row = 8; row < 16; row++) {
drawPixel(baseX + 11*pixelSize, baseY + row*pixelSize, '#a08030', pixelSize);
}
}
// Head
for (let row = 2; row < 9; row++) {
for (let col = 5; col < 10; col++) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#c4a050', pixelSize);
}
}
// Ears - position based on scare
if (scareLevel <= 1) {
// Ears up
drawPixel(baseX + 4*pixelSize, baseY + 3*pixelSize, '#8a6a30', pixelSize);
drawPixel(baseX + 4*pixelSize, baseY + 4*pixelSize, '#8a6a30', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 3*pixelSize, '#8a6a30', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 4*pixelSize, '#8a6a30', pixelSize);
} else {
// Ears back/flattened
drawPixel(baseX + 4*pixelSize, baseY + 2*pixelSize, '#8a6a30', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 2*pixelSize, '#8a6a30', pixelSize);
}
// Eyes - dark (with blinking)
if (!player.isBlinking) {
drawPixel(baseX + 5*pixelSize, baseY + 4*pixelSize, '#3a2010', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 4*pixelSize, '#3a2010', pixelSize);
}
// Nose - black
drawPixel(baseX + 7*pixelSize, baseY + 5*pixelSize, '#1a1a1a', pixelSize);
// Tail - up normally, tucked when scared
if (scareLevel <= 1) {
// Tail up
drawPixel(baseX + 2*pixelSize, baseY + 10*pixelSize, '#c4a050', pixelSize);
drawPixel(baseX + 2*pixelSize, baseY + 9*pixelSize, '#c4a050', pixelSize);
drawPixel(baseX + 2*pixelSize, baseY + 8*pixelSize, '#c4a050', pixelSize);
drawPixel(baseX + 3*pixelSize, baseY + 7*pixelSize, '#c4a050', pixelSize);
} else {
// Tail tucked down
drawPixel(baseX + 2*pixelSize, baseY + 15*pixelSize, '#c4a050', pixelSize);
drawPixel(baseX + 2*pixelSize, baseY + 16*pixelSize, '#c4a050', pixelSize);
}
// Collar - red
drawPixel(baseX + 5*pixelSize, baseY + 8*pixelSize, '#cc2222', pixelSize);
drawPixel(baseX + 6*pixelSize, baseY + 8*pixelSize, '#cc2222', pixelSize);
drawPixel(baseX + 7*pixelSize, baseY + 8*pixelSize, '#cc2222', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 8*pixelSize, '#cc2222', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 8*pixelSize, '#cc2222', pixelSize);
// Collar tag - small metallic square
drawPixel(baseX + 7*pixelSize, baseY + 9*pixelSize, '#7a6a3a', pixelSize);
// Paws - toe pads
drawPixel(baseX + 4*pixelSize, baseY + 18*pixelSize, '#e0e0e0', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 18*pixelSize, '#e0e0e0', pixelSize);
}
// ===== CAT CHARACTER (PIXEL ART) =====
function drawCat(screenY) {
const scareLevel = getScareLevel();
const pixelSize = 2;
const baseX = player.x;
const baseY = screenY;
// Body - grey
for (let row = 8; row < 18; row++) {
for (let col = 3; col < 12; col++) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#808080', pixelSize);
}
}
// Body shading (darker side for volume)
if (player.facingRight) {
for (let row = 8; row < 16; row++) {
drawPixel(baseX + 3*pixelSize, baseY + row*pixelSize, '#606060', pixelSize);
}
} else {
for (let row = 8; row < 16; row++) {
drawPixel(baseX + 11*pixelSize, baseY + row*pixelSize, '#606060', pixelSize);
}
}
// Stripes
for (let row = 10; row < 16; row++) {
if (row % 2 === 0) {
drawPixel(baseX + 5*pixelSize, baseY + row*pixelSize, '#606060', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + row*pixelSize, '#606060', pixelSize);
}
}
// Head
for (let row = 2; row < 9; row++) {
for (let col = 4; col < 11; col++) {
if (row < 8 || (row === 8 && col > 4 && col < 10)) {
drawPixel(baseX + col*pixelSize, baseY + row*pixelSize, '#808080', pixelSize);
}
}
}
// Ears - pointed triangles
if (scareLevel <= 1) {
// Normal ears up
drawPixel(baseX + 4*pixelSize, baseY + 2*pixelSize, '#ffa0a0', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 2*pixelSize, '#ffa0a0', pixelSize);
drawPixel(baseX + 4*pixelSize, baseY + 1*pixelSize, '#808080', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 1*pixelSize, '#808080', pixelSize);
} else {
// Ears back
drawPixel(baseX + 5*pixelSize, baseY + 2*pixelSize, '#ffa0a0', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 2*pixelSize, '#ffa0a0', pixelSize);
}
// Eyes - green with vertical pupils (with blinking)
if (!player.isBlinking) {
drawPixel(baseX + 5*pixelSize, baseY + 4*pixelSize, '#44cc44', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 4*pixelSize, '#44cc44', pixelSize);
// Pupils - dilate when scared
if (scareLevel <= 1) {
drawPixel(baseX + 5*pixelSize, baseY + 5*pixelSize, '#000000', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 5*pixelSize, '#000000', pixelSize);
} else {
drawPixel(baseX + 4*pixelSize, baseY + 4*pixelSize, '#000000', pixelSize);
drawPixel(baseX + 5*pixelSize, baseY + 4*pixelSize, '#000000', pixelSize);
drawPixel(baseX + 9*pixelSize, baseY + 4*pixelSize, '#000000', pixelSize);
drawPixel(baseX + 10*pixelSize, baseY + 4*pixelSize, '#000000', pixelSize);
}
}
// Whiskers - animated based on breathing/movement
const whiskerPhase = Math.sin(player.breathePhase) * 0.5;
const whiskerCol1 = Math.floor(3 - whiskerPhase);
const whiskerCol2 = Math.floor(11 + whiskerPhase);
drawPixel(baseX + whiskerCol1*pixelSize, baseY + 6*pixelSize, '#f0f0f0', pixelSize);
drawPixel(baseX + whiskerCol2*pixelSize, baseY + 6*pixelSize, '#f0f0f0', pixelSize);
// Tail - curved up normally, puffed when scared
if (scareLevel <= 1) {
// Tail up
drawPixel(baseX + 12*pixelSize, baseY + 10*pixelSize, '#808080', pixelSize);
drawPixel(baseX + 13*pixelSize, baseY + 9*pixelSize, '#808080', pixelSize);
drawPixel(baseX + 13*pixelSize, baseY + 8*pixelSize, '#808080', pixelSize);
} else {
// Tail puffed
drawPixel(baseX + 12*pixelSize, baseY + 9*pixelSize, '#808080', pixelSize);
drawPixel(baseX + 13*pixelSize, baseY + 9*pixelSize, '#808080', pixelSize);
drawPixel(baseX + 13*pixelSize, baseY + 10*pixelSize, '#808080', pixelSize);
}
// Paws - white toe tips
drawPixel(baseX + 4*pixelSize, baseY + 18*pixelSize, '#e0e0e0', pixelSize);
drawPixel(baseX + 8*pixelSize, baseY + 18*pixelSize, '#e0e0e0', pixelSize);
}
// 착지 임팩트 플래시 효과
function drawLandingFlash() {
if (player.landingImpact <= 0) return;
const intensity = player.landingImpact;
// 하얀 플래시 링 - 착지 지점 중심으로 퍼져나감
const screenY = player.y + cameraY + player.height;
const radius = (1 - intensity) * 60 + 10;
ctx.save();
// 글로우 효과를 반투명 두꺼운 링으로 대체 (shadowBlur 제거 - 성능 최적화)
ctx.globalAlpha = intensity * 0.2;
ctx.strokeStyle = '#4a7878';
ctx.lineWidth = 8 * intensity;
ctx.beginPath();
ctx.arc(player.x + player.width / 2, screenY, radius, 0, Math.PI * 2);
ctx.stroke();
ctx.globalAlpha = intensity * 0.5;
ctx.strokeStyle = '#ffffff';
ctx.lineWidth = 3 * intensity;
ctx.beginPath();
ctx.arc(player.x + player.width / 2, screenY, radius, 0, Math.PI * 2);
ctx.stroke();
ctx.restore();
}
// ═══════════════════════════════════════════════════════════════════════════════
// PLAYER DRAWING
// ═══════════════════════════════════════════════════════════════════════════════
// 플레이어 그리기 (화면 좌표로 변환)
function drawPlayer() {
ctx.save();
// 화면 좌표로 변환
const screenY = player.y + cameraY;
// Apply squashStretch transform
const centerX = player.x + player.width / 2;
const centerY = screenY + player.height / 2;
ctx.translate(centerX, centerY);
// 웅크리기 강화: 충전 중에는 squash 추가 적용
const chargeSquash = (player.isCharging && player.isOnGround)
? (1 - (player.jumpPower / MAX_JUMP_POWER) * 0.3)
: 1;
ctx.scale(1, player.squashStretch * chargeSquash);
ctx.translate(-centerX, -centerY);
// 선택된 캐릭터에 따라 그리기
switch (selectedCharacter) {
case 'skeleton':
drawSkeleton(screenY);
break;
case 'human':
drawHuman(screenY);
break;
case 'dog':
drawDog(screenY);
break;
case 'cat':
drawCat(screenY);
break;
}
// 존별 캐릭터 상태 이펙트
const zone = getCurrentZone();
// 고도에서 호흡 이펙트 (작은 안개 입김)
if (zone >= 3 && player.isOnGround && Math.random() < 0.05) {
impactParticles.push({
x: player.x + player.width / 2 + (player.facingRight ? 8 : -8),
y: screenY + 6,
vx: player.facingRight ? 0.5 : -0.5,
vy: -0.3,
size: 2,
life: 0.6,
decay: 0.03,
color: 'rgba(200, 200, 255, 0.3)'
});
}
// 고도에서 땀 이펙트
if (zone >= 5 && Math.random() < 0.02) {
impactParticles.push({
x: player.x + player.width / 2 + (Math.random() - 0.5) * 10,
y: screenY + 4,
vx: 0,
vy: 0.5 + Math.random() * 0.5,
size: 1,
life: 0.8,
decay: 0.04,
color: '#88ccff'
});
}
// 충전 중 표시 (사이버네틱 차지 링)
if (player.isCharging && player.isOnGround) {
const chargeRatio = player.jumpPower / MAX_JUMP_POWER;
const chargeR = Math.floor(90 + chargeRatio * 165);
const chargeG = Math.floor(136 - chargeRatio * 80);
const chargeB = Math.floor(136 - chargeRatio * 80);
const chargeColor = `rgb(${chargeR},${chargeG},${chargeB})`;
// 충전 링 (shadowBlur 제거 - 성능 최적화)
ctx.globalAlpha = 0.3;
ctx.strokeStyle = chargeColor;
ctx.lineWidth = 6;
ctx.beginPath();
ctx.arc(player.x + player.width / 2, screenY - 10, 8 + player.jumpPower / 3, 0, Math.PI * 2);
ctx.stroke();
ctx.globalAlpha = 1;
ctx.strokeStyle = chargeColor;
ctx.lineWidth = 2;
ctx.beginPath();
ctx.arc(player.x + player.width / 2, screenY - 10, 8 + player.jumpPower / 3, 0, Math.PI * 2);
ctx.stroke();
// 외부 링
ctx.strokeStyle = '#6a4a5a';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.arc(player.x + player.width / 2, screenY - 10, 12 + player.jumpPower / 2, 0, (player.jumpPower / MAX_JUMP_POWER) * Math.PI * 2);
ctx.stroke();
// 방향 화살표 (홀로그래픽 - shadowBlur 제거)
if (player.direction !== 0) {
ctx.globalAlpha = 0.3;
ctx.fillStyle = '#5a8888';
ctx.beginPath();
const arrowX = player.x + player.width / 2 + player.direction * 25;
const arrowY = screenY + player.height / 2;
ctx.moveTo(arrowX - player.direction * 2, arrowY - 12);
ctx.lineTo(arrowX + player.direction * 17, arrowY);
ctx.lineTo(arrowX - player.direction * 2, arrowY + 12);
ctx.fill();
ctx.globalAlpha = 1;
ctx.fillStyle = '#5a8888';
ctx.beginPath();
ctx.moveTo(arrowX, arrowY - 10);
ctx.lineTo(arrowX + player.direction * 15, arrowY);
ctx.lineTo(arrowX, arrowY + 10);
ctx.fill();
}
// Ground crack effect during charging
if (player.isCharging && player.isOnGround) {
const chargeRatio = player.jumpPower / MAX_JUMP_POWER;
const zoneTheme = getCurrentZoneTheme();
// Energy gather particles (converging toward player)
if (chargeRatio > 0.3) {
ctx.fillStyle = '#5a8888';
ctx.globalAlpha = chargeRatio * 0.5;
for (let i = 0; i < 6; i++) {
const angle = (Date.now() / 200 + i * Math.PI / 3) % (Math.PI * 2);
const dist = 40 * (1 - chargeRatio) + 10;
const px = player.x + player.width / 2 + Math.cos(angle) * dist;
const py = screenY + player.height / 2 + Math.sin(angle) * dist;
ctx.fillRect(px - 1, py - 1, 3, 3);
}
ctx.globalAlpha = 1;
}
// Ground cracks beneath player
if (chargeRatio > 0.5) {
ctx.strokeStyle = zoneTheme ? zoneTheme.blockBorder : '#5a8888';
ctx.globalAlpha = chargeRatio * 0.6;
ctx.lineWidth = 1;
const groundY = screenY + player.height;
for (let i = 0; i < 4; i++) {
ctx.beginPath();
const startX = player.x + player.width / 2;
ctx.moveTo(startX, groundY);
ctx.lineTo(startX + (i % 2 === 0 ? 1 : -1) * (10 + i * 8) * chargeRatio, groundY + 5 + i * 3);
ctx.stroke();
}
ctx.globalAlpha = 1;
}
// Screen subtle vibration during high charge
if (chargeRatio > 0.7) {
screenShakeIntensity = Math.max(screenShakeIntensity, chargeRatio * 1.5);
}
}
}
ctx.restore();
}
// ═══════════════════════════════════════════════════════════════════════════════
// BLOCK DRAWING
// ═══════════════════════════════════════════════════════════════════════════════
// 블록 그리기 - Pixel Art Platforms
function drawBlocks() {
const zoneTheme = getCurrentZoneTheme();
const zone = getCurrentZone();
const pixelSize = 4;
for (const block of blocks) {
// 사라진 크럼블링 블록 스킵
if (block.disappeared) continue;
let screenY = block.y + cameraY;
// 화면에 보이는 블록만 그리기
if (screenY > -50 && screenY < canvas.height + 50) {
// 무빙 블록의 오프셋 계산
const blockX = block.type === 'moving' ? block.x + block.moveOffset : block.x;
// Apply wobble effect
if (block.wobble > 0) {
const wobbleOffset = Math.sin(block.wobble * 10) * block.wobble * 3;
screenY += wobbleOffset;
}
// Depth fog effect
const distFromPlayer = Math.abs(screenY - (player.y + cameraY));
const depthFade = Math.max(0.3, 1 - distFromPlayer / 600);
ctx.globalAlpha *= depthFade;
// 페이크 블록 처리
if (block.type === 'fake') {
ctx.globalAlpha *= block.opacity;
}
// Zone 0-1 (Cyberpunk): Metal plates with rivets - simplified for performance
if (zone <= 1) {
ctx.fillStyle = zoneTheme.blockColor1;
ctx.fillRect(blockX, screenY, block.width, block.height);
// Simplified texture: single accent layer instead of nested loops
ctx.fillStyle = '#2a4a5a';
ctx.globalAlpha = 0.4;
ctx.fillRect(blockX, screenY, block.width, block.height * 0.4);
ctx.globalAlpha = 1;
// Simplified circuit traces: fewer lines
ctx.strokeStyle = '#3a6868';
ctx.globalAlpha = 0.3;
ctx.lineWidth = 1;
for (let i = 0; i < block.width; i += 40) {
ctx.beginPath();
ctx.moveTo(blockX + i, screenY);
ctx.lineTo(blockX + i, screenY + block.height);
ctx.stroke();
}
ctx.globalAlpha = 1;
// Simplified rivets: reduced count
ctx.fillStyle = '#4a7878';
ctx.globalAlpha = 0.4;
ctx.fillRect(blockX + 10, screenY + 5, pixelSize, pixelSize);
ctx.fillRect(blockX + block.width - 14, screenY + 5, pixelSize, pixelSize);
ctx.globalAlpha = 1;
}
// Zone 2-3 (Red tint): Cracked concrete with moss
else if (zone <= 3) {
ctx.fillStyle = zoneTheme.blockColor1;
ctx.fillRect(blockX, screenY, block.width, block.height);
// Concrete texture
ctx.fillStyle = '#3a2a2a';
for (let x = 0; x < block.width; x += pixelSize * 2) {
for (let y = 0; y < block.height; y += pixelSize * 2) {
ctx.fillRect(blockX + x, screenY + y, pixelSize, pixelSize);
}
}
// Cracks
ctx.strokeStyle = '#1a0a0a';
ctx.globalAlpha = 0.5;
ctx.lineWidth = 1;
for (let i = 0; i < block.width; i += 25) {
ctx.beginPath();
ctx.moveTo(blockX + i, screenY);
ctx.lineTo(blockX + i + 5, screenY + block.height);
ctx.stroke();
}
ctx.globalAlpha = 1;
// Moss spots
ctx.fillStyle = '#00aa44';
ctx.globalAlpha = 0.6;
for (let x = 10; x < block.width; x += 30) {
for (let y = 5; y < block.height; y += 15) {
if ((x + y) % 20 === 0) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize);
}
}
}
ctx.globalAlpha = 1;
// Blood splatter dots (zone 3+)
if (zone >= 3) {
ctx.fillStyle = '#ff0000';
ctx.globalAlpha = 0.4;
for (let i = 0; i < 5; i++) {
const x = blockX + Math.random() * block.width;
const y = screenY + Math.random() * block.height;
ctx.fillRect(x, y, pixelSize, pixelSize);
}
ctx.globalAlpha = 1;
}
}
// Zone 4-5 (Heavy fog/Very dark): Rusty metal with dents
else if (zone <= 5) {
ctx.fillStyle = zoneTheme.blockColor1;
ctx.fillRect(blockX, screenY, block.width, block.height);
// Rusty metal texture
ctx.fillStyle = '#4a3a2a';
for (let x = 0; x < block.width; x += pixelSize * 4) {
for (let y = 0; y < block.height; y += pixelSize * 3) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize * 2);
}
}
// Dents and rust
ctx.fillStyle = '#2a1a0a';
ctx.globalAlpha = 0.7;
for (let x = 15; x < block.width; x += 25) {
for (let y = 5; y < block.height; y += 10) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize);
}
}
ctx.globalAlpha = 1;
// Dripping effects
ctx.strokeStyle = '#1a0a00';
ctx.globalAlpha = 0.5;
ctx.lineWidth = 1;
for (let i = 0; i < block.width; i += 30) {
ctx.beginPath();
ctx.moveTo(blockX + i, screenY + block.height);
ctx.lineTo(blockX + i, screenY + block.height + 10);
ctx.stroke();
}
ctx.globalAlpha = 1;
}
// Zone 6-7 (Glitch/Darkness): Corrupted platforms with red glow
else if (zone <= 7) {
ctx.fillStyle = zoneTheme.blockColor1;
ctx.fillRect(blockX, screenY, block.width, block.height);
// Corrupted pattern
ctx.fillStyle = '#1a0a1a';
for (let x = 0; x < block.width; x += pixelSize * 3) {
for (let y = 0; y < block.height; y += pixelSize * 3) {
if ((x + y) % (pixelSize * 6) === 0) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize * 2);
}
}
}
// Red glow cracks
ctx.strokeStyle = '#ff0000';
ctx.globalAlpha = 0.8;
ctx.lineWidth = 1;
for (let i = 0; i < block.width; i += 20) {
ctx.beginPath();
ctx.moveTo(blockX + i, screenY);
ctx.lineTo(blockX + i + 5, screenY + block.height);
ctx.stroke();
}
ctx.globalAlpha = 1;
// Red glow edges
ctx.strokeStyle = '#ff0000';
ctx.globalAlpha = 0.4;
ctx.lineWidth = 2;
ctx.strokeRect(blockX, screenY, block.width, block.height);
ctx.globalAlpha = 1;
}
// Zone 8 (Surreal): Floating crystal-like platforms with yellow glow
else if (zone === 8) {
ctx.fillStyle = zoneTheme.blockColor1;
ctx.fillRect(blockX, screenY, block.width, block.height);
// Crystal pattern
ctx.fillStyle = '#3a3a5a';
for (let x = 0; x < block.width; x += pixelSize * 5) {
for (let y = 0; y < block.height; y += pixelSize * 4) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 3, pixelSize * 2);
}
}
// Dim amber glow spots
ctx.fillStyle = '#6a5a3a';
ctx.globalAlpha = 0.5;
for (let x = 10; x < block.width; x += 25) {
for (let y = 5; y < block.height; y += 10) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize * 2);
}
}
ctx.globalAlpha = 1;
// Dim amber glow border
ctx.strokeStyle = '#7a6a4a';
ctx.globalAlpha = 0.5;
ctx.lineWidth = 1;
ctx.strokeRect(blockX, screenY, block.width, block.height);
ctx.globalAlpha = 1;
}
// Zone 9 (Redemption): Natural wood/stone with green moss and flowers
else {
ctx.fillStyle = zoneTheme.blockColor1;
ctx.fillRect(blockX, screenY, block.width, block.height);
// Wood/stone texture
ctx.fillStyle = '#3a4a2a';
for (let x = 0; x < block.width; x += pixelSize * 3) {
for (let y = 0; y < block.height; y += pixelSize * 2) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize);
}
}
// Muted green moss coverage
ctx.fillStyle = '#4a6a5a';
ctx.globalAlpha = 0.5;
for (let x = 0; x < block.width; x += 20) {
for (let y = 0; y < block.height; y += 12) {
if ((x + y) % 30 === 0) {
ctx.fillRect(blockX + x, screenY + y, pixelSize * 2, pixelSize);