User prompt
when timer ir reseted it should go back to 100%
User prompt
make sure timer does a full circle
User prompt
Nice! lets move score and the timer a little lower though since timer is cut off. Timer should be seen completely
User prompt
Lets implemente the circular ting arround the score
User prompt
Can you optimize the code to reuse lines. For example do not write again down up left and right for when they have NOT. just add the NOT and keep the other words in their original position
User prompt
Center all Not messages. Both the not and the directio
User prompt
Game over should happen when player misses
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'var particle = scoreContainer.addChild(new Particle());' Line Number: 104
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'var pattern = digitPatterns[digit];' Line Number: 85
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'forEach')' in or related to this line: 'scoreParticles.forEach(function (particle) {' Line Number: 72
User prompt
Score numbers should also be formed by particles but score should still be tracked
User prompt
When not words appear make sure also the direction word below not is also centered
User prompt
Make sure not words are also centered
User prompt
Add more words to the game. they will be Not right, not left, not up, and not down. Should be in two lines one over the other. Logically when this appear, player shoild awipe in any of the other 3 directions to win a point
User prompt
NOT word shoild also use particles!
User prompt
Randomly add the word NOT on top of the direction which means player should swipe in any direction but that one
User prompt
Make words wiggle radius smaller
User prompt
Make particle cloud a litttle bugger
User prompt
Particles in word shoild not move in the cloud, rhey should have a very small wiggle
User prompt
Particles in bacground should be always moving withi the cloud shape it has
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Particle = Container.expand(function () { var self = Container.call(this); var particleGraphics = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5 }); self.originalTint = getRandomFluorescentColor(); self.tint = self.originalTint; self.rotation = Math.PI * 2 * Math.random(); particleGraphics.blendMode = 1; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ var scoreDisplay; var currentDirection = null; var swipeStartX = null; var swipeStartY = null; var isCorrectSwipe = false; var canSwipe = true; // Array to store score particles var scoreParticles = []; // Function to generate bright fluorescent colors function getRandomFluorescentColor() { var fluorColors = [0xFF00FF, // Magenta 0x00FFFF, // Cyan 0xFFFF00, // Yellow 0x00FF00, // Lime 0xFF0080, // Hot Pink 0x80FF00, // Chartreuse 0xFF8000, // Orange 0x00FF80, // Spring Green 0x8000FF, // Purple 0xFF0040, // Rose 0x40FF00, // Green Yellow 0x00FFBF // Turquoise ]; return fluorColors[Math.floor(Math.random() * fluorColors.length)]; } function updateScoreDisplay(score) { // Clear existing score particles scoreParticles.forEach(function (particle) { particle.destroy(); }); scoreParticles = []; var scoreString = score.toString(); var digitSpacing = 80; // Space between digits var particleSize = 12; // Size of each particle in the digit var startX = -(scoreString.length - 1) * digitSpacing / 2; // Create particles for each digit for (var digitIndex = 0; digitIndex < scoreString.length; digitIndex++) { var digit = scoreString[digitIndex]; var pattern = digitPatterns[digit]; var digitX = startX + digitIndex * digitSpacing; // Create particles based on pattern for (var row = 0; row < pattern.length; row++) { for (var col = 0; col < pattern[row].length; col++) { if (pattern[row][col] === 1) { var particle = scoreContainer.addChild(new Particle()); particle.x = digitX + (col - 2) * particleSize; particle.y = (row - 3) * particleSize; particle.scale.set(0.3, 0.3); particle.tint = 0xFFFFFF; // White color for score scoreParticles.push(particle); } } } } } // Initialize score display updateScoreDisplay(0); for (var i = 0; i < 500; i++) { var particle = game.addChild(new Particle()); var angle = Math.random() * Math.PI * 2; var radius = Math.random() * 300; particle.x = 1024 + Math.cos(angle) * radius; particle.y = 1366 + Math.sin(angle) * radius; particle.scale.set(4, 4); // Initialize cloud movement parameters particle.cloudAngle = angle; particle.cloudRadius = radius; particle.cloudSpeed = 0.01 + Math.random() * 0.02; particle.driftSpeed = 0.5 + Math.random() * 1; } // Create letter positions for directional words - centered on screen var letterPositions = { UP: [ // U { x: 724, y: 1200 }, { x: 724, y: 1300 }, { x: 724, y: 1400 }, { x: 724, y: 1500 }, { x: 824, y: 1500 }, { x: 924, y: 1500 }, { x: 1024, y: 1200 }, { x: 1024, y: 1300 }, { x: 1024, y: 1400 }, { x: 1024, y: 1500 }, // P { x: 1224, y: 1200 }, { x: 1224, y: 1300 }, { x: 1224, y: 1400 }, { x: 1224, y: 1500 }, { x: 1324, y: 1200 }, { x: 1424, y: 1200 }, { x: 1424, y: 1300 }, { x: 1324, y: 1350 }, { x: 1424, y: 1350 }], DOWN: [ // D { x: 324, y: 1200 }, { x: 324, y: 1300 }, { x: 324, y: 1400 }, { x: 324, y: 1500 }, { x: 424, y: 1200 }, { x: 524, y: 1250 }, { x: 524, y: 1450 }, { x: 424, y: 1500 }, // O { x: 724, y: 1250 }, { x: 724, y: 1450 }, { x: 774, y: 1200 }, { x: 874, y: 1200 }, { x: 924, y: 1250 }, { x: 924, y: 1450 }, { x: 774, y: 1500 }, { x: 874, y: 1500 }, // W { x: 1124, y: 1200 }, { x: 1144, y: 1300 }, { x: 1164, y: 1400 }, { x: 1184, y: 1500 }, { x: 1274, y: 1400 }, { x: 1364, y: 1400 }, { x: 1384, y: 1500 }, { x: 1404, y: 1400 }, { x: 1424, y: 1300 }, { x: 1444, y: 1200 }, // N { x: 1574, y: 1200 }, { x: 1574, y: 1300 }, { x: 1574, y: 1400 }, { x: 1574, y: 1500 }, { x: 1644, y: 1280 }, { x: 1714, y: 1360 }, { x: 1784, y: 1440 }, { x: 1854, y: 1200 }, { x: 1854, y: 1300 }, { x: 1854, y: 1400 }, { x: 1854, y: 1500 }], LEFT: [ // L { x: 424, y: 1200 }, { x: 424, y: 1300 }, { x: 424, y: 1400 }, { x: 424, y: 1500 }, { x: 524, y: 1500 }, { x: 624, y: 1500 }, // E { x: 824, y: 1200 }, { x: 824, y: 1300 }, { x: 824, y: 1400 }, { x: 824, y: 1500 }, { x: 924, y: 1200 }, { x: 1024, y: 1200 }, { x: 924, y: 1350 }, { x: 924, y: 1500 }, { x: 1024, y: 1500 }, // F { x: 1224, y: 1200 }, { x: 1224, y: 1300 }, { x: 1224, y: 1400 }, { x: 1224, y: 1500 }, { x: 1324, y: 1200 }, { x: 1424, y: 1200 }, { x: 1324, y: 1350 }, // T { x: 1624, y: 1200 }, { x: 1724, y: 1200 }, { x: 1824, y: 1200 }, { x: 1724, y: 1300 }, { x: 1724, y: 1400 }, { x: 1724, y: 1500 }], RIGHT: [ // Shifted left by 225px to fit on screen // R { x: 49, // 274 - 225 y: 1200 }, { x: 49, // 274 - 225 y: 1300 }, { x: 49, // 274 - 225 y: 1400 }, { x: 49, // 274 - 225 y: 1500 }, { x: 149, // 374 - 225 y: 1200 }, { x: 249, // 474 - 225 y: 1200 }, { x: 249, // 474 - 225 y: 1300 }, { x: 149, // 374 - 225 y: 1350 }, { x: 249, // 474 - 225 y: 1400 }, { x: 349, // 574 - 225 y: 1500 }, // I { x: 549, // 774 - 225 y: 1200 }, { x: 649, // 874 - 225 y: 1200 }, { x: 749, // 974 - 225 y: 1200 }, { x: 649, // 874 - 225 y: 1300 }, { x: 649, // 874 - 225 y: 1400 }, { x: 549, // 774 - 225 y: 1500 }, { x: 649, // 874 - 225 y: 1500 }, { x: 749, // 974 - 225 y: 1500 }, // G { x: 949, // 1174 - 225 y: 1250 }, { x: 999, // 1224 - 225 y: 1200 }, { x: 1099, // 1324 - 225 y: 1200 }, { x: 1149, // 1374 - 225 y: 1200 }, { x: 949, // 1174 - 225 y: 1350 }, { x: 949, // 1174 - 225 y: 1450 }, { x: 999, // 1224 - 225 y: 1500 }, { x: 1099, // 1324 - 225 y: 1500 }, { x: 1149, // 1374 - 225 y: 1450 }, { x: 1149, // 1374 - 225 y: 1400 }, { x: 1099, // 1324 - 225 y: 1400 }, // H { x: 1349, // 1574 - 225 y: 1200 }, { x: 1349, // 1574 - 225 y: 1300 }, { x: 1349, // 1574 - 225 y: 1400 }, { x: 1349, // 1574 - 225 y: 1500 }, { x: 1449, // 1674 - 225 y: 1350 }, { x: 1549, // 1774 - 225 y: 1350 }, { x: 1649, // 1874 - 225 y: 1200 }, { x: 1649, // 1874 - 225 y: 1300 }, { x: 1649, // 1874 - 225 y: 1400 }, { x: 1649, // 1874 - 225 y: 1500 }, // T { x: 1799, // 2024 - 225 y: 1200 }, { x: 1899, // 2124 - 225 y: 1200 }, { x: 1999, // 2224 - 225 y: 1200 }, { x: 1899, // 2124 - 225 y: 1300 }, { x: 1899, // 2124 - 225 y: 1400 }, { x: 1899, // 2124 - 225 y: 1500 }], 'NOT UP': [ // NOT on first line // NOT on first line // N { x: 424 + 50, y: 1100 }, { x: 424 + 50, y: 1200 }, { x: 424 + 50, y: 1300 }, { x: 424 + 50, y: 1400 }, { x: 494 + 150 + 50, y: 1180 }, { x: 564 + 150 + 50, y: 1260 }, { x: 634 + 150 + 50, y: 1340 }, { x: 704 + 150 + 50, y: 1100 }, { x: 704 + 150 + 50, y: 1200 }, { x: 704 + 150 + 50, y: 1300 }, { x: 704 + 150 + 50, y: 1400 }, // O { x: 874 + 150 + 50, y: 1150 }, { x: 874 + 150 + 50, y: 1350 }, { x: 924 + 150 + 50, y: 1100 }, { x: 1024 + 150 + 50, y: 1100 }, { x: 1074 + 150 + 50, y: 1150 }, { x: 1074 + 150 + 50, y: 1350 }, { x: 924 + 150 + 50, y: 1400 }, { x: 1024 + 150 + 50, y: 1400 }, // T { x: 1174 + 150 + 50, y: 1100 }, { x: 1274 + 150 + 50, y: 1100 }, { x: 1374 + 150 + 50, y: 1100 }, { x: 1274 + 150 + 50, y: 1200 }, { x: 1274 + 150 + 50, y: 1300 }, { x: 1274 + 150 + 50, y: 1400 }, // UP on second line // U { x: 724, y: 1500 }, { x: 724, y: 1600 }, { x: 724, y: 1700 }, { x: 724, y: 1800 }, { x: 824, y: 1800 }, { x: 924, y: 1800 }, { x: 1024, y: 1500 }, { x: 1024, y: 1600 }, { x: 1024, y: 1700 }, { x: 1024, y: 1800 }, // P { x: 1224, y: 1500 }, { x: 1224, y: 1600 }, { x: 1224, y: 1700 }, { x: 1224, y: 1800 }, { x: 1324, y: 1500 }, { x: 1424, y: 1500 }, { x: 1424, y: 1600 }, { x: 1324, y: 1650 }, { x: 1424, y: 1650 }], 'NOT DOWN': [ // NOT on first line // N { x: 424 + 150 + 50, y: 1100 }, { x: 424 + 150 + 50, y: 1200 }, { x: 424 + 150 + 50, y: 1300 }, { x: 424 + 150 + 50, y: 1400 }, { x: 494 + 150 + 50, y: 1180 }, { x: 564 + 150 + 50, y: 1260 }, { x: 634 + 150 + 50, y: 1340 }, { x: 704 + 150 + 50, y: 1100 }, { x: 704 + 150 + 50, y: 1200 }, { x: 704 + 150 + 50, y: 1300 }, { x: 704 + 150 + 50, y: 1400 }, // O { x: 874 + 150 + 50, y: 1150 }, { x: 874 + 150 + 50, y: 1350 }, { x: 924 + 150 + 50, y: 1100 }, { x: 1024 + 150 + 50, y: 1100 }, { x: 1074 + 150 + 50, y: 1150 }, { x: 1074 + 150 + 50, y: 1350 }, { x: 924 + 150 + 50, y: 1400 }, { x: 1024 + 150 + 50, y: 1400 }, // T { x: 1174 + 150 + 50, y: 1100 }, { x: 1274 + 150 + 50, y: 1100 }, { x: 1374 + 150 + 50, y: 1100 }, { x: 1274 + 150 + 50, y: 1200 }, { x: 1274 + 150 + 50, y: 1300 }, { x: 1274 + 150 + 50, y: 1400 }, // DOWN on second line // D { x: 524 + 150 + 50, y: 1500 }, { x: 524 + 150 + 50, y: 1600 }, { x: 524 + 150 + 50, y: 1700 }, { x: 524 + 150 + 50, y: 1800 }, { x: 624 + 150 + 50, y: 1500 }, { x: 724 + 150 + 50, y: 1550 }, { x: 724 + 150 + 50, y: 1750 }, { x: 624 + 150 + 50, y: 1800 }, // O { x: 924 + 150 + 50, y: 1550 }, { x: 924 + 150 + 50, y: 1750 }, { x: 974 + 150 + 50, y: 1500 }, { x: 1074 + 150 + 50, y: 1500 }, { x: 1124 + 150 + 50, y: 1550 }, { x: 1124 + 150 + 50, y: 1750 }, { x: 974 + 150 + 50, y: 1800 }, { x: 1074 + 150 + 50, y: 1800 }, // W { x: 1324 + 150 + 50, y: 1500 }, { x: 1344 + 150 + 50, y: 1600 }, { x: 1364 + 150 + 50, y: 1700 }, { x: 1384 + 150 + 50, y: 1800 }, { x: 1474 + 150 + 50, y: 1700 }, { x: 1564 + 150 + 50, y: 1700 }, { x: 1584 + 150 + 50, y: 1800 }, { x: 1604 + 150 + 50, y: 1700 }, { x: 1624 + 150 + 50, y: 1600 }, { x: 1644 + 150 + 50, y: 1500 }, // N { x: 1774 + 150 + 50, y: 1500 }, { x: 1774 + 150 + 50, y: 1600 }, { x: 1774 + 150 + 50, y: 1700 }, { x: 1774 + 150 + 50, y: 1800 }, { x: 1844 + 150 + 50, y: 1580 }, { x: 1914 + 150 + 50, y: 1660 }, { x: 1984 + 150 + 50, y: 1740 }, { x: 2054 + 150 + 50, y: 1500 }, { x: 2054 + 150 + 50, y: 1600 }, { x: 2054 + 150 + 50, y: 1700 }, { x: 2054 + 150 + 50, y: 1800 }], 'NOT LEFT': [ // NOT on first line // N { x: 424 + 150 + 50, y: 1100 }, { x: 424 + 150 + 50, y: 1200 }, { x: 424 + 150 + 50, y: 1300 }, { x: 424 + 150 + 50, y: 1400 }, { x: 494 + 150 + 50, y: 1180 }, { x: 564 + 150 + 50, y: 1260 }, { x: 634 + 150 + 50, y: 1340 }, { x: 704 + 150 + 50, y: 1100 }, { x: 704 + 150 + 50, y: 1200 }, { x: 704 + 150 + 50, y: 1300 }, { x: 704 + 150 + 50, y: 1400 }, // O { x: 874 + 150 + 50, y: 1150 }, { x: 874 + 150 + 50, y: 1350 }, { x: 924 + 150 + 50, y: 1100 }, { x: 1024 + 150 + 50, y: 1100 }, { x: 1074 + 150 + 50, y: 1150 }, { x: 1074 + 150 + 50, y: 1350 }, { x: 924 + 150 + 50, y: 1400 }, { x: 1024 + 150 + 50, y: 1400 }, // T { x: 1174 + 150 + 50, y: 1100 }, { x: 1274 + 150 + 50, y: 1100 }, { x: 1374 + 150 + 50, y: 1100 }, { x: 1274 + 150 + 50, y: 1200 }, { x: 1274 + 150 + 50, y: 1300 }, { x: 1274 + 150 + 50, y: 1400 }, // LEFT on second line // L { x: 624 + 150 + 50, y: 1500 }, { x: 624 + 150 + 50, y: 1600 }, { x: 624 + 150 + 50, y: 1700 }, { x: 624 + 150 + 50, y: 1800 }, { x: 724 + 150 + 50, y: 1800 }, { x: 824 + 150 + 50, y: 1800 }, // E { x: 1024 + 150 + 50, y: 1500 }, { x: 1024 + 150 + 50, y: 1600 }, { x: 1024 + 150 + 50, y: 1700 }, { x: 1024 + 150 + 50, y: 1800 }, { x: 1124 + 150 + 50, y: 1500 }, { x: 1224 + 150 + 50, y: 1500 }, { x: 1124 + 150 + 50, y: 1650 }, { x: 1124 + 150 + 50, y: 1800 }, { x: 1224 + 150 + 50, y: 1800 }, // F { x: 1424 + 150 + 50, y: 1500 }, { x: 1424 + 150 + 50, y: 1600 }, { x: 1424 + 150 + 50, y: 1700 }, { x: 1424 + 150 + 50, y: 1800 }, { x: 1524 + 150 + 50, y: 1500 }, { x: 1624 + 150 + 50, y: 1500 }, { x: 1524 + 150 + 50, y: 1650 }, // T { x: 1824 + 150 + 50, y: 1500 }, { x: 1924 + 150 + 50, y: 1500 }, { x: 2024 + 150 + 50, y: 1500 }, { x: 1924 + 150 + 50, y: 1600 }, { x: 1924 + 150 + 50, y: 1700 }, { x: 1924 + 150 + 50, y: 1800 }], 'NOT RIGHT': [ // NOT on first line - shifted left by 400px // N { x: 24 + 150 + 50, y: 1100 }, { x: 24 + 150 + 50, y: 1200 }, { x: 24 + 150 + 50, y: 1300 }, { x: 24 + 150 + 50, y: 1400 }, { x: 94 + 150 + 50, y: 1180 }, { x: 164 + 150 + 50, y: 1260 }, { x: 234 + 150 + 50, y: 1340 }, { x: 304 + 150 + 50, y: 1100 }, { x: 304 + 150 + 50, y: 1200 }, { x: 304 + 150 + 50, y: 1300 }, { x: 304 + 150 + 50, y: 1400 }, // O { x: 474 + 150 + 50, y: 1150 }, { x: 474 + 150 + 50, y: 1350 }, { x: 524 + 150 + 50, y: 1100 }, { x: 624 + 150 + 50, y: 1100 }, { x: 674 + 150 + 50, y: 1150 }, { x: 674 + 150 + 50, y: 1350 }, { x: 524 + 150 + 50, y: 1400 }, { x: 624 + 150 + 50, y: 1400 }, // T { x: 774 + 150 + 50, y: 1100 }, { x: 874 + 150 + 50, y: 1100 }, { x: 974 + 150 + 50, y: 1100 }, { x: 874 + 150 + 50, y: 1200 }, { x: 874 + 150 + 50, y: 1300 }, { x: 874 + 150 + 50, y: 1400 }, // RIGHT on second line - shifted left by 400px // R { x: 249 + 150 + 50, y: 1500 }, { x: 249 + 150 + 50, y: 1600 }, { x: 249 + 150 + 50, y: 1700 }, { x: 249 + 150 + 50, y: 1800 }, { x: 349 + 150 + 50, y: 1500 }, { x: 449 + 150 + 50, y: 1500 }, { x: 449 + 150 + 50, y: 1600 }, { x: 349 + 150 + 50, y: 1650 }, { x: 449 + 150 + 50, y: 1700 }, { x: 549 + 150 + 50, y: 1800 }, // I { x: 749 + 150 + 50, y: 1500 }, { x: 849 + 150 + 50, y: 1500 }, { x: 949 + 150 + 50, y: 1500 }, { x: 849 + 150 + 50, y: 1600 }, { x: 849 + 150 + 50, y: 1700 }, { x: 749 + 150 + 50, y: 1800 }, { x: 849 + 150 + 50, y: 1800 }, { x: 949 + 150 + 50, y: 1800 }, // G { x: 1149 + 150 + 50, y: 1550 }, { x: 1199 + 150 + 50, y: 1500 }, { x: 1299 + 150 + 50, y: 1500 }, { x: 1349 + 150 + 50, y: 1500 }, { x: 1149 + 150 + 50, y: 1650 }, { x: 1149 + 150 + 50, y: 1750 }, { x: 1199 + 150 + 50, y: 1800 }, { x: 1299 + 150 + 50, y: 1800 }, { x: 1349 + 150 + 50, y: 1750 }, { x: 1349 + 150 + 50, y: 1700 }, { x: 1299 + 150 + 50, y: 1700 }, // H { x: 1549 + 150 + 50, y: 1500 }, { x: 1549 + 150 + 50, y: 1600 }, { x: 1549 + 150 + 50, y: 1700 }, { x: 1549 + 150 + 50, y: 1800 }, { x: 1649 + 150 + 50, y: 1650 }, { x: 1749 + 150 + 50, y: 1650 }, { x: 1849 + 150 + 50, y: 1500 }, { x: 1849 + 150 + 50, y: 1600 }, { x: 1849 + 150 + 50, y: 1700 }, { x: 1849 + 150 + 50, y: 1800 }, // T { x: 1999 + 150 + 50, y: 1500 }, { x: 2099 + 150 + 50, y: 1500 }, { x: 2199 + 150 + 50, y: 1500 }, { x: 2099 + 150 + 50, y: 1600 }, { x: 2099 + 150 + 50, y: 1700 }, { x: 2099 + 150 + 50, y: 1800 }] }; // Initialize score display container var scoreContainer = new Container(); scoreContainer.x = 1024; // Center horizontally scoreContainer.y = 100; // Position at top game.addChild(scoreContainer); // Digit patterns for particles (5x7 grid for each digit) var digitPatterns = { '0': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]], '1': [[0, 0, 1, 0, 0], [0, 1, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [1, 1, 1, 1, 1]], '2': [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 1, 1, 1]], '3': [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [1, 1, 1, 1, 1]], '4': [[1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1]], '5': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [1, 1, 1, 1, 1]], '6': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]], '7': [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0]], '8': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]], '9': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [1, 1, 1, 1, 1]] }; game.move = function (x, y) { // Not used for swipe detection, but required by engine }; game.up = function (x, y) { if (!canSwipe || swipeStartX === null || swipeStartY === null) return; var swipeDeltaX = x - swipeStartX; var swipeDeltaY = y - swipeStartY; var swipeThreshold = 100; var detectedDirection = null; if (Math.abs(swipeDeltaX) > Math.abs(swipeDeltaY)) { if (swipeDeltaX > swipeThreshold) { detectedDirection = 'RIGHT'; } else if (swipeDeltaX < -swipeThreshold) { detectedDirection = 'LEFT'; } } else { if (swipeDeltaY > swipeThreshold) { detectedDirection = 'DOWN'; } else if (swipeDeltaY < -swipeThreshold) { detectedDirection = 'UP'; } } var isCorrect = false; if (currentDirection.indexOf('NOT ') === 0) { // For NOT directions, any swipe except the forbidden one is correct var forbiddenDirection = currentDirection.substring(4); // Remove 'NOT ' prefix if (detectedDirection !== null && detectedDirection !== forbiddenDirection) { isCorrect = true; } } else { // For regular directions, must match exactly isCorrect = detectedDirection === currentDirection; } if (isCorrect) { // Correct swipe! isCorrectSwipe = true; LK.setScore(LK.getScore() + 1); updateScoreDisplay(LK.getScore()); // Flash green for correct LK.effects.flashScreen(0x00FF00, 300); // Check win condition if (LK.getScore() >= 20) { LK.showYouWin(); return; } // Start next round canSwipe = false; showNextDirection(); } else if (detectedDirection !== null) { // Wrong swipe LK.effects.flashScreen(0xFF0000, 300); } swipeStartX = null; swipeStartY = null; }; function showNextDirection() { // Choose random direction - include NOT directions var directions = ['UP', 'DOWN', 'LEFT', 'RIGHT', 'NOT UP', 'NOT DOWN', 'NOT LEFT', 'NOT RIGHT']; currentDirection = directions[Math.floor(Math.random() * directions.length)]; var directionColors = { UP: 0xFFFF00, // Bright Yellow DOWN: 0x00FFFF, // Bright Cyan LEFT: 0x00FF00, // Bright Green RIGHT: 0xFF00FF, // Bright Magenta 'NOT UP': 0xFF4500, // Orange Red 'NOT DOWN': 0x00CED1, // Dark Turquoise 'NOT LEFT': 0x32CD32, // Lime Green 'NOT RIGHT': 0xFF1493 // Deep Pink }; // Get particles var particles = []; for (var i = 0; i < game.children.length; i++) { if (game.children[i] instanceof Particle) { particles.push(game.children[i]); } } // Animate particles to scatter first var scatterDuration = 500; particles.forEach(function (particle, index) { var angle = Math.random() * Math.PI * 2; var radius = 400 + Math.random() * 800; tween(particle, { x: 1024 + Math.cos(angle) * radius, y: 1366 + Math.sin(angle) * radius, scaleX: 0.5, scaleY: 0.5, rotation: Math.random() * Math.PI * 2, tint: particle.originalTint }, { duration: scatterDuration, easing: tween.easeOut }); }); // After scatter, form the word LK.setTimeout(function () { // Clone and shuffle the letter positions for the current direction var positions = letterPositions[currentDirection].slice(); for (var i = positions.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = positions[i]; positions[i] = positions[j]; positions[j] = temp; } var tweenFunctions = [tween.easeIn, tween.easeOut, tween.elasticOut, tween.bounceOut, tween.easeInOut]; var randomTweenFunction = tweenFunctions[Math.floor(Math.random() * tweenFunctions.length)]; // Use direction color for the word var wordColor = directionColors[currentDirection]; particles.forEach(function (particle, index) { if (index < positions.length) { // Form letter // Clear cloud parameters so particle is identified as word particle delete particle.cloudAngle; delete particle.cloudRadius; delete particle.cloudSpeed; delete particle.driftSpeed; tween(particle, { x: positions[index].x, y: positions[index].y, scaleX: 1.2, // Increased scale for better readability scaleY: 1.2, // Increased scale for better readability rotation: 0, tint: wordColor // Same color for all particles in the word }, { duration: 800, easing: randomTweenFunction, delay: index * 10 }); } else { // Extra particles float around in cloud-like motion var angle = Math.random() * Math.PI * 2; var radius = 300 + Math.random() * 400; var targetX = 1024 + Math.cos(angle) * radius; var targetY = 1366 + Math.sin(angle) * radius; // Store cloud movement parameters on particle particle.cloudAngle = angle; particle.cloudRadius = radius; particle.cloudSpeed = 0.01 + Math.random() * 0.02; particle.driftSpeed = 0.5 + Math.random() * 1; tween(particle, { x: targetX, y: targetY, scaleX: 0.2, scaleY: 0.2, rotation: Math.random() * Math.PI * 2, tint: particle.originalTint }, { duration: 1000, easing: tween.linear }); } }); // Enable swiping after animation LK.setTimeout(function () { canSwipe = true; }, 900); }, scatterDuration + 100); } // Add continuous movement for background particles game.update = function () { // Move particles that are in cloud formation for (var i = 0; i < game.children.length; i++) { var particle = game.children[i]; if (particle instanceof Particle) { // Check if particle is part of the word (not in cloud formation) if (particle.cloudAngle === undefined) { // Add small wiggle to word particles var wiggleX = Math.sin(Date.now() * 0.003 + i) * 0.5; var wiggleY = Math.cos(Date.now() * 0.003 + i) * 0.5; particle.x = particle.x + wiggleX; particle.y = particle.y + wiggleY; } else { // Original cloud movement for background particles // Update cloud angle for circular drift particle.cloudAngle += particle.cloudSpeed; // Calculate new position within cloud shape var centerX = 1024; var centerY = 1366; var cloudX = centerX + Math.cos(particle.cloudAngle) * particle.cloudRadius; var cloudY = centerY + Math.sin(particle.cloudAngle) * particle.cloudRadius; // Add some drift movement var driftX = Math.sin(Date.now() * 0.001 * particle.driftSpeed) * 20; var driftY = Math.cos(Date.now() * 0.001 * particle.driftSpeed) * 15; // Apply movement particle.x = cloudX + driftX; particle.y = cloudY + driftY; // Gentle rotation particle.rotation += 0.01; } } } // Add wiggle effect to score particles scoreParticles.forEach(function (particle, index) { var wiggleX = Math.sin(Date.now() * 0.002 + index * 0.1) * 0.3; var wiggleY = Math.cos(Date.now() * 0.002 + index * 0.1) * 0.3; particle.x = particle.x + wiggleX; particle.y = particle.y + wiggleY; }); }; // Start the first round showNextDirection(); game.down = function (x, y) { if (!canSwipe) return; swipeStartX = x; swipeStartY = y; isCorrectSwipe = false; };
===================================================================
--- original.js
+++ change.js
@@ -33,8 +33,10 @@
var swipeStartX = null;
var swipeStartY = null;
var isCorrectSwipe = false;
var canSwipe = true;
+// Array to store score particles
+var scoreParticles = [];
// Function to generate bright fluorescent colors
function getRandomFluorescentColor() {
var fluorColors = [0xFF00FF,
// Magenta
@@ -1348,10 +1350,8 @@
'7': [[1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0]],
'8': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]],
'9': [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1], [0, 0, 0, 0, 1], [0, 0, 0, 0, 1], [1, 1, 1, 1, 1]]
};
-// Array to store score particles
-var scoreParticles = [];
game.move = function (x, y) {
// Not used for swipe detection, but required by engine
};
game.up = function (x, y) {