@@ -295,7 +295,7 @@ const CRTShader = {
295295 resolution : { value : new THREE . Vector2 ( ) } ,
296296 time : { value : 0.0 } ,
297297 aberrationStrength : { value : 0.003 } ,
298- scanlineIntensity : { value : 0.6 } , // Increased from 0.4 for more visible scanlines
298+
299299 vignetteStrength : { value : 0.3 } ,
300300 noiseIntensity : { value : 0.08 } ,
301301 curvature : { value : 0.15 } ,
@@ -312,7 +312,6 @@ const CRTShader = {
312312 uniform vec2 resolution;
313313 uniform float time;
314314 uniform float aberrationStrength;
315- uniform float scanlineIntensity;
316315 uniform float vignetteStrength;
317316 uniform float noiseIntensity;
318317 uniform float curvature;
@@ -431,7 +430,7 @@ let backgroundMusic: AudioBufferSourceNode | null = null;
431430let musicBuffer : AudioBuffer | null = null ;
432431let musicGainNode : GainNode | null = null ;
433432let isMuted = false ;
434- let musicFadeTimeout : number | null = null ; // Track fade timeout for cleanup // Track mute state
433+ let musicFadeTimeout : number | null = null ; // Track fade timeout for cleanup
435434
436435// Load and decode the background music
437436async function loadBackgroundMusic ( ) {
@@ -441,7 +440,6 @@ async function loadBackgroundMusic() {
441440 const response = await fetch ( "/8-bit-game-loop.wav" ) ;
442441 const arrayBuffer = await response . arrayBuffer ( ) ;
443442 musicBuffer = await audioContext . decodeAudioData ( arrayBuffer ) ;
444- console . log ( "Background music loaded" ) ;
445443 } catch ( error ) {
446444 console . error ( "Error loading background music:" , error ) ;
447445 }
@@ -489,8 +487,6 @@ function startBackgroundMusic() {
489487 targetVolume ,
490488 audioContext . currentTime + 1.2
491489 ) ;
492-
493- console . log ( "Background music started with fade in" ) ;
494490 } catch ( error ) {
495491 console . error ( "Error starting background music:" , error ) ;
496492 }
@@ -539,7 +535,6 @@ function stopBackgroundMusic() {
539535 }
540536
541537 musicFadeTimeout = null ;
542- console . log ( "Background music stopped with fade out" ) ;
543538 } , 600 ) ; // Wait for fade to complete
544539 } catch ( error ) {
545540 console . error ( "Error fading out background music:" , error ) ;
@@ -586,7 +581,6 @@ async function initializeAudio() {
586581 audioContext = new ( window . AudioContext ||
587582 ( window as any ) . webkitAudioContext ) ( ) ;
588583 isAudioInitialized = true ;
589- console . log ( "Audio context initialized" ) ;
590584
591585 // Load music immediately but don't start playing
592586 await loadBackgroundMusic ( ) ;
@@ -879,8 +873,6 @@ const gameState = {
879873 duration : 0.6 , // 0.6 seconds for much more snappy camera animation
880874 delay : 0.2 , // 200ms delay before drop starts (reduced from 500ms)
881875 delayProgress : 0 , // Track delay progress
882- startPosition : { x : 0 , y : 0 , z : 0 } , // Center position
883- targetPosition : { x : 0 , y : 0 , z : 0 } , // Will be set when animation starts
884876 } ,
885877 player : {
886878 velocity : { x : 0 , y : 0 } ,
@@ -917,7 +909,6 @@ const gameState = {
917909 falling : boolean ; // Track if this cube is falling
918910 fallVelocity : number ; // Falling velocity for this cube
919911 } > ;
920- colorIndex : number ; // Store the color index for explosion matching
921912 platformIndex : number ; // Platform creation index for consistent behavior
922913 // Movement properties for difficulty progression
923914 movement : {
@@ -935,7 +926,6 @@ const gameState = {
935926 maxLife : number ;
936927 } > ,
937928 nextPlatformY : 2 ,
938- platformSpacing : 3.5 , // Increased from 2.5 for more spacing
939929 score : 0 ,
940930 highScore : 0 ,
941931 keys : {
@@ -1068,47 +1058,41 @@ function getDifficultyPlatformCubeCount(): number {
10681058 if ( score <= 10 ) {
10691059 // Score 0-10: Mostly 4 cubes (80%), some 3 cubes (20%)
10701060 const chance4 = 0.8 - ( score / 10 ) * 0.3 ; // 80% to 50%
1071- const chance3 = 1 - chance4 ; // 20% to 50%
10721061
10731062 if ( random < chance4 ) return 4 ;
10741063 else return 3 ;
10751064 } else if ( score <= 25 ) {
10761065 // Score 10-25: Mix of 4 and 3, trending toward 3
10771066 const t = ( score - 10 ) / ( 25 - 10 ) ;
10781067 const chance4 = 0.5 - t * 0.4 ; // 50% to 10%
1079- const chance3 = 1 - chance4 ; // 50% to 90%
10801068
10811069 if ( random < chance4 ) return 4 ;
10821070 else return 3 ;
10831071 } else if ( score <= 40 ) {
10841072 // Score 25-40: Mostly 3 cubes, some 2 cubes starting to appear
10851073 const t = ( score - 25 ) / ( 40 - 25 ) ;
10861074 const chance3 = 0.9 - t * 0.4 ; // 90% to 50%
1087- const chance2 = 1 - chance3 ; // 10% to 50%
10881075
10891076 if ( random < chance3 ) return 3 ;
10901077 else return 2 ;
10911078 } else if ( score <= 60 ) {
10921079 // Score 40-60: Mix of 3 and 2, trending toward 2
10931080 const t = ( score - 40 ) / ( 60 - 40 ) ;
10941081 const chance3 = 0.5 - t * 0.4 ; // 50% to 10%
1095- const chance2 = 1 - chance3 ; // 50% to 90%
10961082
10971083 if ( random < chance3 ) return 3 ;
10981084 else return 2 ;
10991085 } else if ( score <= 80 ) {
11001086 // Score 60-80: Mostly 2 cubes, some 1 cube starting to appear
11011087 const t = ( score - 60 ) / ( 80 - 60 ) ;
11021088 const chance2 = 0.9 - t * 0.4 ; // 90% to 50%
1103- const chance1 = 1 - chance2 ; // 10% to 50%
11041089
11051090 if ( random < chance2 ) return 2 ;
11061091 else return 1 ;
11071092 } else {
11081093 // Score 80+: Mix of 2 and 1, trending toward 1 (extreme difficulty)
11091094 const t = Math . min ( 1 , ( score - 80 ) / 40 ) ; // Cap progression at score 120
11101095 const chance2 = 0.5 - t * 0.3 ; // 50% to 20%
1111- const chance1 = 1 - chance2 ; // 50% to 80%
11121096
11131097 if ( random < chance2 ) return 2 ;
11141098 else return 1 ;
@@ -1225,9 +1209,6 @@ function triggerGlitch() {
12251209
12261210// Create initial platforms
12271211function createPlatform ( x : number , y : number ) {
1228- // Use platform count to cycle through colors
1229- const colorIndex = gameState . platforms . length ;
1230-
12311212 // Get current difficulty-based properties
12321213 const movementSpeed = getDifficultyMovementSpeed ( ) ;
12331214 const cubeCount = getDifficultyPlatformCubeCount ( ) ;
@@ -1281,7 +1262,6 @@ function createPlatform(x: number, y: number) {
12811262 position : { x, y } ,
12821263 size : { width : platformWidth , height : cubeSize } ,
12831264 cubes : cubes ,
1284- colorIndex : colorIndex , // Store the color index for explosion matching
12851265 platformIndex : platformIndex , // Store platform creation index for consistent behavior
12861266 movement : {
12871267 enabled : false , // Will be determined dynamically
@@ -1428,7 +1408,6 @@ function startGame() {
14281408 // Start music when game begins
14291409 if ( audioContext && audioContext . state === "suspended" ) {
14301410 audioContext . resume ( ) . then ( ( ) => {
1431- console . log ( "Audio context resumed" ) ;
14321411 startBackgroundMusic ( ) ;
14331412 } ) ;
14341413 } else if ( audioContext && musicBuffer ) {
@@ -1551,11 +1530,9 @@ function updateGame() {
15511530 const particleSpreadZ = 10 ;
15521531
15531532 // Calculate downward particle movement based on player's upward velocity
1554- const baseDownwardSpeed = 0 ; // Base speed particles move down
1555- const velocityMultiplier = gameState . gameStarted
1533+ const totalDownwardSpeed = gameState . gameStarted
15561534 ? Math . max ( 0 , gameState . player . velocity . y )
15571535 : 0 ; // Only use velocity when game is active
1558- const totalDownwardSpeed = baseDownwardSpeed + velocityMultiplier ;
15591536
15601537 for ( let i = 0 ; i < particleCount ; i ++ ) {
15611538 const i3 = i * 3 ;
@@ -2053,8 +2030,7 @@ function updateGame() {
20532030 gameState . player . position . y + gameState . world . offset ;
20542031 }
20552032
2056- // Add subtle parallax effect based on player movement
2057- // No longer need to move camera, but we can add subtle screen shake or other effects here if desired
2033+
20582034
20592035 // Generate more platforms as needed
20602036 if ( gameState . player . position . y > gameState . nextPlatformY - 20 ) {
@@ -2074,38 +2050,7 @@ function updateGame() {
20742050 // Update score display
20752051 scoreElement . textContent = `SCORE ${ gameState . score } ` ;
20762052
2077- // Debug: Count moving platforms periodically
2078- if (
2079- gameState . score > 0 &&
2080- gameState . score % 5 === 0 &&
2081- Math . random ( ) < 0.02
2082- ) {
2083- const movingCount = gameState . platforms . filter (
2084- ( p ) => p . movement . enabled
2085- ) . length ;
2086- const totalCount = gameState . platforms . length ;
2087- const expectedChance = getDifficultyMovementChance ( ) ;
2088-
2089- // Let's also check platform index distribution
2090- const platformIndices = gameState . platforms . map ( ( p ) => p . platformIndex ) ;
2091- const minIndex = Math . min ( ...platformIndices ) ;
2092- const maxIndex = Math . max ( ...platformIndices ) ;
2093-
2094- console . log (
2095- `Score: ${ gameState . score } , Moving: ${ movingCount } /${ totalCount } (${ (
2096- ( movingCount / totalCount ) *
2097- 100
2098- ) . toFixed ( 1 ) } %), Expected: ${ ( expectedChance * 100 ) . toFixed ( 1 ) } %`
2099- ) ;
2100- console . log (
2101- `Platform indices range: ${ minIndex } to ${ maxIndex } , Global counter: ${ globalPlatformCounter } `
2102- ) ;
2103- console . log (
2104- `Movement threshold: platforms 0-${ Math . floor (
2105- expectedChance * 100 - 1
2106- ) } should move out of every 100`
2107- ) ;
2108- }
2053+
21092054
21102055 // Update high score display
21112056 highScoreElement . textContent = `BEST ${ gameState . highScore } ` ;
@@ -2202,9 +2147,6 @@ function updateGame() {
22022147 Object . keys ( keyPressed ) . forEach ( ( key ) => {
22032148 keyPressed [ key ] = false ;
22042149 } ) ;
2205-
2206- // Update cursor visibility based on game state
2207- updateCursorVisibility ( ) ;
22082150}
22092151
22102152// Generate initial platforms
@@ -2266,7 +2208,7 @@ scene.add(particles);
22662208// Particle animation variables
22672209let particleTime = 0 ;
22682210
2269- // Set up DRACO loader (even though we don't need it, Three.js expects it)
2211+ // Set up DRACO loader for GLB model compression
22702212const dracoLoader = new DRACOLoader ( ) ;
22712213dracoLoader . setDecoderPath (
22722214 "https://www.gstatic.com/draco/versioned/decoders/1.5.6/"
@@ -2378,27 +2320,14 @@ loader.load(
23782320 copilotModel . position . set ( 0 , 0 , 0 ) ;
23792321
23802322 scene . add ( copilotModel ) ;
2381- console . log (
2382- "Copilot model loaded successfully with GitHub Copilot colors!"
2383- ) ;
2384- console . log ( `Applied GitHub Copilot colors to ${ meshIndex } mesh parts` ) ;
2385- } ,
2386- ( progress ) => {
2387- console . log (
2388- "Loading progress:" ,
2389- ( progress . loaded / progress . total ) * 100 + "%"
2390- ) ;
23912323 } ,
2324+ undefined , // No progress callback needed
23922325 ( error ) => {
23932326 console . error ( "Error loading GLB model:" , error ) ;
23942327 }
23952328) ;
23962329
2397- // OrbitControls - disable for game mode
2398- // const controls = new OrbitControls(camera, renderer.domElement);
23992330
2400- // Remove old mouse interaction code since we're now a jumping game
2401- // const raycaster = new THREE.Raycaster();
24022331
24032332// Add UI for score display
24042333const scoreElement = document . createElement ( "div" ) ;
0 commit comments