/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var DJButton = Container.expand(function (buttonType, value) { var self = Container.call(this); var buttonGraphics; if (buttonType === 'number') { buttonGraphics = self.attachAsset('numberButton', { anchorX: 0.5, anchorY: 0.5 }); } else if (buttonType === 'blue') { buttonGraphics = self.attachAsset('blueButton', { anchorX: 0.5, anchorY: 0.5 }); } else if (buttonType === 'red') { buttonGraphics = self.attachAsset('redButton', { anchorX: 0.5, anchorY: 0.5 }); } else if (buttonType === 'green') { buttonGraphics = self.attachAsset('greenButton', { anchorX: 0.5, anchorY: 0.5 }); } var buttonText = new Text2(value.toString(), { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.buttonType = buttonType; self.value = value; self.isPressed = false; self.press = function () { if (!self.isPressed) { self.isPressed = true; tween(buttonGraphics, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, onFinish: function onFinish() { tween(buttonGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100, onFinish: function onFinish() { self.isPressed = false; } }); } }); } }; self.down = function (x, y, obj) { self.press(); game.handleButtonPress(self.buttonType, self.value); }; return self; }); var Dancer = Container.expand(function () { var self = Container.call(this); var dancerGraphics = self.attachAsset('dancer', { anchorX: 0.5, anchorY: 1 }); self.state = 'neutral'; // neutral, happy, angry self.isAnimating = false; self.setHappy = function () { if (self.state !== 'happy') { self.state = 'happy'; dancerGraphics.tint = 0xffaa00; self.startDanceAnimation(); } }; self.setAngry = function () { if (self.state !== 'angry') { self.state = 'angry'; dancerGraphics.tint = 0x990000; self.stopDanceAnimation(); } }; self.setNeutral = function () { self.state = 'neutral'; dancerGraphics.tint = 0xff6600; self.stopDanceAnimation(); }; self.startDanceAnimation = function () { if (!self.isAnimating) { self.isAnimating = true; self.danceLoop(); } }; self.stopDanceAnimation = function () { self.isAnimating = false; tween.stop(self, { scaleX: true, scaleY: true, rotation: true }); self.scaleX = 1; self.scaleY = 1; self.rotation = 0; }; self.danceLoop = function () { if (!self.isAnimating) return; tween(self, { scaleX: 1.1, scaleY: 0.9, rotation: 0.1 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { if (!self.isAnimating) return; tween(self, { scaleX: 0.9, scaleY: 1.1, rotation: -0.1 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { if (!self.isAnimating) return; tween(self, { scaleX: 1, scaleY: 1, rotation: 0 }, { duration: 200, easing: tween.easeInOut, onFinish: function onFinish() { self.danceLoop(); } }); } }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x220044 }); /**** * Game Code ****/ // Sounds // Musical note decoration // Dancers // Buttons // DJ Console and decorative elements // Game variables var dancers = []; var djButtons = []; var currentPrompt = null; var promptSequence = []; var gameSpeed = 2000; // ms between prompts var consecutiveCorrect = 0; var maxMistakes = 3; var currentMistakes = 0; var isGameActive = true; var lightBeams = []; var confettiParticles = []; // UI elements var scoreText = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var mistakesText = new Text2('Mistakes: 0/3', { size: 40, fill: 0xFF4444 }); mistakesText.anchor.set(1, 0); mistakesText.x = LK.gui.topRight.x - 20; mistakesText.y = 20; LK.gui.topRight.addChild(mistakesText); // Create DJ table var djTable = game.addChild(LK.getAsset('djTable', { anchorX: 0.5, anchorY: 1, x: 1024, y: 2200 })); // Add white stripes to DJ table for (var i = 0; i < 4; i++) { var stripe = djTable.addChild(LK.getAsset('whiteStripe', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -400 + i * 120 })); } // Create green screen var greenScreen = djTable.addChild(LK.getAsset('greenScreen', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 200 })); greenScreen.tint = 0xffffff; // White color var promptText = new Text2('', { size: 120, fill: 0xFFFFFF }); promptText.anchor.set(0.5, 0.5); promptText.alpha = 0; // Start hidden greenScreen.addChild(promptText); // Add decorative knobs for (var i = 0; i < 6; i++) { var knob = djTable.addChild(LK.getAsset('knob', { anchorX: 0.5, anchorY: 0.5, x: -600 + i * 120, y: -450 })); } // Add piano keys for (var i = 0; i < 12; i++) { var key = djTable.addChild(LK.getAsset('key', { anchorX: 0.5, anchorY: 0.5, x: -300 + i * 35, y: -150 })); } // Add headphones var headphones = djTable.addChild(LK.getAsset('headphones', { anchorX: 0.5, anchorY: 0.5, x: -750, y: -350 })); // Add musical notes decoration for (var i = 0; i < 8; i++) { var note = djTable.addChild(LK.getAsset('musicalNote', { anchorX: 0.5, anchorY: 0.5, x: -800 + i * 80, y: -100 })); } // Create numbered buttons (1-5) in two rows: 1,2,3 on top, 4,5 on bottom for (var i = 1; i <= 5; i++) { var numberButton = new DJButton('number', i); if (i <= 3) { // Top row: buttons 1, 2, 3 numberButton.x = djTable.x + 200 + (i - 1) * 200; numberButton.y = djTable.y - 350; } else { // Bottom row: buttons 4, 5 numberButton.x = djTable.x + 300 + (i - 4) * 200; numberButton.y = djTable.y - 150; } game.addChild(numberButton); djButtons.push(numberButton); } // Create colored buttons var colorButtons = [{ type: 'blue', color: 'B' }, { type: 'red', color: 'R' }, { type: 'green', color: 'G' }]; for (var i = 0; i < colorButtons.length; i++) { var colorButton = new DJButton(colorButtons[i].type, colorButtons[i].color); colorButton.x = djTable.x - 450 + i * 180; colorButton.y = djTable.y - 220; game.addChild(colorButton); djButtons.push(colorButton); } // Create light beams in background for (var i = 0; i < 8; i++) { var lightBeam = game.addChild(LK.getAsset('lightBeam', { anchorX: 0.5, anchorY: 0.5, x: 200 + i * 250, y: 1000 })); var lightColors = [0xffff00, 0xff00ff, 0x00ffff, 0xff6600, 0x6600ff, 0x00ff66]; lightBeam.tint = lightColors[i % lightColors.length]; lightBeam.alpha = 0.3; lightBeam.rotation = Math.PI / 4; lightBeams.push(lightBeam); } // Create confetti particles for (var i = 0; i < 25; i++) { var confetti = game.addChild(LK.getAsset('confetti', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732 })); var confettiColors = [0xff0066, 0x00ff66, 0x6600ff, 0xffff00, 0xff6600, 0x00ffff]; confetti.tint = confettiColors[i % confettiColors.length]; confetti.alpha = 0.7; confetti.scaleX = Math.random() * 0.5 + 0.5; confetti.scaleY = Math.random() * 0.5 + 0.5; confetti.rotation = Math.random() * Math.PI * 2; confettiParticles.push(confetti); } // Create dancers for (var i = 0; i < 15; i++) { var dancer = new Dancer(); // Position upper dancers in two rows with more spacing if (i < 8) { // First row (top) - 8 dancers dancer.x = 50 + i * 250; dancer.y = 600; } else { // Second row (below first row) - 7 dancers dancer.x = 175 + (i - 8) * 250; dancer.y = 800; } game.addChild(dancer); dancers.push(dancer); } // Generate prompt from predefined sequence var level1Sequence = ['B', 'R', 'G', '1', '2', '3', '4', '5']; var sequenceIndex = 0; function generatePrompt() { // Show prompts randomly (karışık) var randomIndex = Math.floor(Math.random() * level1Sequence.length); var prompt = level1Sequence[randomIndex]; return prompt; } // Show new prompt function showPrompt() { if (!isGameActive) return; currentPrompt = generatePrompt(); promptText.setText(currentPrompt); // Make prompt text visible and animate it sliding through the screen promptText.alpha = 1; promptText.x = -greenScreen.width / 2 - 100; // Start from left side outside screen promptText.y = 0; // Center vertically // Animate text sliding from left to right through the green screen tween(promptText, { x: greenScreen.width / 2 + 100 // End at right side outside screen }, { duration: 5000, easing: tween.linear, onFinish: function onFinish() { // Check if prompt was missed (still has current prompt when animation ends) if (currentPrompt && isGameActive) { // Play wrong sound for missed prompt LK.getSound('wrongSound').play(); currentMistakes++; consecutiveCorrect = 0; // Make dancers angry for (var i = 0; i < dancers.length; i++) { dancers[i].setAngry(); } // Check game over if (currentMistakes >= maxMistakes) { isGameActive = false; isGameOver = true; LK.clearInterval(promptTimer); LK.showGameOver(); return; } // Update UI scoreText.setText('Score: ' + LK.getScore()); mistakesText.setText('Mistakes: ' + currentMistakes + '/' + maxMistakes); // Reset dancers to neutral after a delay LK.setTimeout(function () { if (isGameActive) { for (var i = 0; i < dancers.length; i++) { dancers[i].setNeutral(); } } }, 1000); } // Clear current prompt and reset position currentPrompt = null; promptText.setText(''); promptText.x = 0; promptText.alpha = 0; } }); // Flash screen effect tween(greenScreen, { tint: 0xffffff }, { duration: 100, onFinish: function onFinish() { tween(greenScreen, { tint: 0xffffff }, { duration: 100, onFinish: function onFinish() { greenScreen.tint = 0xffffff; } }); } }); } // Handle button press game.handleButtonPress = function (buttonType, value) { if (!isGameActive || !currentPrompt) return; var isCorrect = false; if (buttonType === 'number' && currentPrompt === value.toString()) { isCorrect = true; } else if (buttonType === 'blue' && currentPrompt === 'B') { isCorrect = true; } else if (buttonType === 'red' && currentPrompt === 'R') { isCorrect = true; } else if (buttonType === 'green' && currentPrompt === 'G') { isCorrect = true; } if (isCorrect) { LK.getSound('correctSound').play(); LK.setScore(LK.getScore() + 10); consecutiveCorrect++; // Make dancers happy for (var i = 0; i < dancers.length; i++) { dancers[i].setHappy(); } // Increase speed every 5 correct answers if (consecutiveCorrect % 5 === 0) { gameSpeed = Math.max(800, gameSpeed - 200); } } else { LK.getSound('wrongSound').play(); currentMistakes++; consecutiveCorrect = 0; // Make dancers angry for (var i = 0; i < dancers.length; i++) { dancers[i].setAngry(); } // Check game over if (currentMistakes >= maxMistakes) { isGameActive = false; isGameOver = true; LK.clearInterval(promptTimer); LK.showGameOver(); return; } } // Update UI scoreText.setText('Score: ' + LK.getScore()); mistakesText.setText('Mistakes: ' + currentMistakes + '/' + maxMistakes); // Clear current prompt currentPrompt = null; promptText.setText(''); // Reset dancers to neutral after a delay LK.setTimeout(function () { if (isGameActive) { for (var i = 0; i < dancers.length; i++) { dancers[i].setNeutral(); } } }, 1000); }; // Game timer for prompts var promptTimer = LK.setInterval(function () { showPrompt(); }, 2000); // Game over click handler var isGameOver = false; game.down = function (x, y, obj) { if (isGameOver) { // Reset game state isGameOver = false; isGameActive = true; currentMistakes = 0; consecutiveCorrect = 0; gameSpeed = 2000; sequenceIndex = 0; currentPrompt = null; LK.setScore(0); // Reset UI scoreText.setText('Score: 0'); mistakesText.setText('Mistakes: 0/3'); promptText.setText(''); promptText.alpha = 0; // Reset all dancers to neutral for (var i = 0; i < dancers.length; i++) { dancers[i].setNeutral(); } // Restart music and game timer LK.playMusic('gameMusic'); promptTimer = LK.setInterval(function () { showPrompt(); }, 2000); // Start first prompt LK.setTimeout(function () { showPrompt(); }, 2000); } }; // Start the game LK.playMusic('gameMusic'); LK.setTimeout(function () { showPrompt(); }, 2000); game.update = function () { // Animate light beams for (var i = 0; i < lightBeams.length; i++) { var beam = lightBeams[i]; beam.alpha = 0.2 + Math.sin(LK.ticks * 0.05 + i) * 0.3; beam.scaleX = 0.8 + Math.sin(LK.ticks * 0.03 + i) * 0.4; } // Animate confetti particles for (var i = 0; i < confettiParticles.length; i++) { var particle = confettiParticles[i]; particle.y += Math.sin(LK.ticks * 0.02 + i) * 2; particle.x += Math.cos(LK.ticks * 0.015 + i) * 1; particle.rotation += 0.02; // Reset position if particle goes off screen if (particle.y > 2800) { particle.y = -50; particle.x = Math.random() * 2048; } if (particle.x > 2100) { particle.x = -50; } if (particle.x < -50) { particle.x = 2100; } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var DJButton = Container.expand(function (buttonType, value) {
var self = Container.call(this);
var buttonGraphics;
if (buttonType === 'number') {
buttonGraphics = self.attachAsset('numberButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (buttonType === 'blue') {
buttonGraphics = self.attachAsset('blueButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (buttonType === 'red') {
buttonGraphics = self.attachAsset('redButton', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (buttonType === 'green') {
buttonGraphics = self.attachAsset('greenButton', {
anchorX: 0.5,
anchorY: 0.5
});
}
var buttonText = new Text2(value.toString(), {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.buttonType = buttonType;
self.value = value;
self.isPressed = false;
self.press = function () {
if (!self.isPressed) {
self.isPressed = true;
tween(buttonGraphics, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(buttonGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
onFinish: function onFinish() {
self.isPressed = false;
}
});
}
});
}
};
self.down = function (x, y, obj) {
self.press();
game.handleButtonPress(self.buttonType, self.value);
};
return self;
});
var Dancer = Container.expand(function () {
var self = Container.call(this);
var dancerGraphics = self.attachAsset('dancer', {
anchorX: 0.5,
anchorY: 1
});
self.state = 'neutral'; // neutral, happy, angry
self.isAnimating = false;
self.setHappy = function () {
if (self.state !== 'happy') {
self.state = 'happy';
dancerGraphics.tint = 0xffaa00;
self.startDanceAnimation();
}
};
self.setAngry = function () {
if (self.state !== 'angry') {
self.state = 'angry';
dancerGraphics.tint = 0x990000;
self.stopDanceAnimation();
}
};
self.setNeutral = function () {
self.state = 'neutral';
dancerGraphics.tint = 0xff6600;
self.stopDanceAnimation();
};
self.startDanceAnimation = function () {
if (!self.isAnimating) {
self.isAnimating = true;
self.danceLoop();
}
};
self.stopDanceAnimation = function () {
self.isAnimating = false;
tween.stop(self, {
scaleX: true,
scaleY: true,
rotation: true
});
self.scaleX = 1;
self.scaleY = 1;
self.rotation = 0;
};
self.danceLoop = function () {
if (!self.isAnimating) return;
tween(self, {
scaleX: 1.1,
scaleY: 0.9,
rotation: 0.1
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (!self.isAnimating) return;
tween(self, {
scaleX: 0.9,
scaleY: 1.1,
rotation: -0.1
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (!self.isAnimating) return;
tween(self, {
scaleX: 1,
scaleY: 1,
rotation: 0
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.danceLoop();
}
});
}
});
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x220044
});
/****
* Game Code
****/
// Sounds
// Musical note decoration
// Dancers
// Buttons
// DJ Console and decorative elements
// Game variables
var dancers = [];
var djButtons = [];
var currentPrompt = null;
var promptSequence = [];
var gameSpeed = 2000; // ms between prompts
var consecutiveCorrect = 0;
var maxMistakes = 3;
var currentMistakes = 0;
var isGameActive = true;
var lightBeams = [];
var confettiParticles = [];
// UI elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var mistakesText = new Text2('Mistakes: 0/3', {
size: 40,
fill: 0xFF4444
});
mistakesText.anchor.set(1, 0);
mistakesText.x = LK.gui.topRight.x - 20;
mistakesText.y = 20;
LK.gui.topRight.addChild(mistakesText);
// Create DJ table
var djTable = game.addChild(LK.getAsset('djTable', {
anchorX: 0.5,
anchorY: 1,
x: 1024,
y: 2200
}));
// Add white stripes to DJ table
for (var i = 0; i < 4; i++) {
var stripe = djTable.addChild(LK.getAsset('whiteStripe', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -400 + i * 120
}));
}
// Create green screen
var greenScreen = djTable.addChild(LK.getAsset('greenScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 200
}));
greenScreen.tint = 0xffffff; // White color
var promptText = new Text2('', {
size: 120,
fill: 0xFFFFFF
});
promptText.anchor.set(0.5, 0.5);
promptText.alpha = 0; // Start hidden
greenScreen.addChild(promptText);
// Add decorative knobs
for (var i = 0; i < 6; i++) {
var knob = djTable.addChild(LK.getAsset('knob', {
anchorX: 0.5,
anchorY: 0.5,
x: -600 + i * 120,
y: -450
}));
}
// Add piano keys
for (var i = 0; i < 12; i++) {
var key = djTable.addChild(LK.getAsset('key', {
anchorX: 0.5,
anchorY: 0.5,
x: -300 + i * 35,
y: -150
}));
}
// Add headphones
var headphones = djTable.addChild(LK.getAsset('headphones', {
anchorX: 0.5,
anchorY: 0.5,
x: -750,
y: -350
}));
// Add musical notes decoration
for (var i = 0; i < 8; i++) {
var note = djTable.addChild(LK.getAsset('musicalNote', {
anchorX: 0.5,
anchorY: 0.5,
x: -800 + i * 80,
y: -100
}));
}
// Create numbered buttons (1-5) in two rows: 1,2,3 on top, 4,5 on bottom
for (var i = 1; i <= 5; i++) {
var numberButton = new DJButton('number', i);
if (i <= 3) {
// Top row: buttons 1, 2, 3
numberButton.x = djTable.x + 200 + (i - 1) * 200;
numberButton.y = djTable.y - 350;
} else {
// Bottom row: buttons 4, 5
numberButton.x = djTable.x + 300 + (i - 4) * 200;
numberButton.y = djTable.y - 150;
}
game.addChild(numberButton);
djButtons.push(numberButton);
}
// Create colored buttons
var colorButtons = [{
type: 'blue',
color: 'B'
}, {
type: 'red',
color: 'R'
}, {
type: 'green',
color: 'G'
}];
for (var i = 0; i < colorButtons.length; i++) {
var colorButton = new DJButton(colorButtons[i].type, colorButtons[i].color);
colorButton.x = djTable.x - 450 + i * 180;
colorButton.y = djTable.y - 220;
game.addChild(colorButton);
djButtons.push(colorButton);
}
// Create light beams in background
for (var i = 0; i < 8; i++) {
var lightBeam = game.addChild(LK.getAsset('lightBeam', {
anchorX: 0.5,
anchorY: 0.5,
x: 200 + i * 250,
y: 1000
}));
var lightColors = [0xffff00, 0xff00ff, 0x00ffff, 0xff6600, 0x6600ff, 0x00ff66];
lightBeam.tint = lightColors[i % lightColors.length];
lightBeam.alpha = 0.3;
lightBeam.rotation = Math.PI / 4;
lightBeams.push(lightBeam);
}
// Create confetti particles
for (var i = 0; i < 25; i++) {
var confetti = game.addChild(LK.getAsset('confetti', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732
}));
var confettiColors = [0xff0066, 0x00ff66, 0x6600ff, 0xffff00, 0xff6600, 0x00ffff];
confetti.tint = confettiColors[i % confettiColors.length];
confetti.alpha = 0.7;
confetti.scaleX = Math.random() * 0.5 + 0.5;
confetti.scaleY = Math.random() * 0.5 + 0.5;
confetti.rotation = Math.random() * Math.PI * 2;
confettiParticles.push(confetti);
}
// Create dancers
for (var i = 0; i < 15; i++) {
var dancer = new Dancer();
// Position upper dancers in two rows with more spacing
if (i < 8) {
// First row (top) - 8 dancers
dancer.x = 50 + i * 250;
dancer.y = 600;
} else {
// Second row (below first row) - 7 dancers
dancer.x = 175 + (i - 8) * 250;
dancer.y = 800;
}
game.addChild(dancer);
dancers.push(dancer);
}
// Generate prompt from predefined sequence
var level1Sequence = ['B', 'R', 'G', '1', '2', '3', '4', '5'];
var sequenceIndex = 0;
function generatePrompt() {
// Show prompts randomly (karışık)
var randomIndex = Math.floor(Math.random() * level1Sequence.length);
var prompt = level1Sequence[randomIndex];
return prompt;
}
// Show new prompt
function showPrompt() {
if (!isGameActive) return;
currentPrompt = generatePrompt();
promptText.setText(currentPrompt);
// Make prompt text visible and animate it sliding through the screen
promptText.alpha = 1;
promptText.x = -greenScreen.width / 2 - 100; // Start from left side outside screen
promptText.y = 0; // Center vertically
// Animate text sliding from left to right through the green screen
tween(promptText, {
x: greenScreen.width / 2 + 100 // End at right side outside screen
}, {
duration: 5000,
easing: tween.linear,
onFinish: function onFinish() {
// Check if prompt was missed (still has current prompt when animation ends)
if (currentPrompt && isGameActive) {
// Play wrong sound for missed prompt
LK.getSound('wrongSound').play();
currentMistakes++;
consecutiveCorrect = 0;
// Make dancers angry
for (var i = 0; i < dancers.length; i++) {
dancers[i].setAngry();
}
// Check game over
if (currentMistakes >= maxMistakes) {
isGameActive = false;
isGameOver = true;
LK.clearInterval(promptTimer);
LK.showGameOver();
return;
}
// Update UI
scoreText.setText('Score: ' + LK.getScore());
mistakesText.setText('Mistakes: ' + currentMistakes + '/' + maxMistakes);
// Reset dancers to neutral after a delay
LK.setTimeout(function () {
if (isGameActive) {
for (var i = 0; i < dancers.length; i++) {
dancers[i].setNeutral();
}
}
}, 1000);
}
// Clear current prompt and reset position
currentPrompt = null;
promptText.setText('');
promptText.x = 0;
promptText.alpha = 0;
}
});
// Flash screen effect
tween(greenScreen, {
tint: 0xffffff
}, {
duration: 100,
onFinish: function onFinish() {
tween(greenScreen, {
tint: 0xffffff
}, {
duration: 100,
onFinish: function onFinish() {
greenScreen.tint = 0xffffff;
}
});
}
});
}
// Handle button press
game.handleButtonPress = function (buttonType, value) {
if (!isGameActive || !currentPrompt) return;
var isCorrect = false;
if (buttonType === 'number' && currentPrompt === value.toString()) {
isCorrect = true;
} else if (buttonType === 'blue' && currentPrompt === 'B') {
isCorrect = true;
} else if (buttonType === 'red' && currentPrompt === 'R') {
isCorrect = true;
} else if (buttonType === 'green' && currentPrompt === 'G') {
isCorrect = true;
}
if (isCorrect) {
LK.getSound('correctSound').play();
LK.setScore(LK.getScore() + 10);
consecutiveCorrect++;
// Make dancers happy
for (var i = 0; i < dancers.length; i++) {
dancers[i].setHappy();
}
// Increase speed every 5 correct answers
if (consecutiveCorrect % 5 === 0) {
gameSpeed = Math.max(800, gameSpeed - 200);
}
} else {
LK.getSound('wrongSound').play();
currentMistakes++;
consecutiveCorrect = 0;
// Make dancers angry
for (var i = 0; i < dancers.length; i++) {
dancers[i].setAngry();
}
// Check game over
if (currentMistakes >= maxMistakes) {
isGameActive = false;
isGameOver = true;
LK.clearInterval(promptTimer);
LK.showGameOver();
return;
}
}
// Update UI
scoreText.setText('Score: ' + LK.getScore());
mistakesText.setText('Mistakes: ' + currentMistakes + '/' + maxMistakes);
// Clear current prompt
currentPrompt = null;
promptText.setText('');
// Reset dancers to neutral after a delay
LK.setTimeout(function () {
if (isGameActive) {
for (var i = 0; i < dancers.length; i++) {
dancers[i].setNeutral();
}
}
}, 1000);
};
// Game timer for prompts
var promptTimer = LK.setInterval(function () {
showPrompt();
}, 2000);
// Game over click handler
var isGameOver = false;
game.down = function (x, y, obj) {
if (isGameOver) {
// Reset game state
isGameOver = false;
isGameActive = true;
currentMistakes = 0;
consecutiveCorrect = 0;
gameSpeed = 2000;
sequenceIndex = 0;
currentPrompt = null;
LK.setScore(0);
// Reset UI
scoreText.setText('Score: 0');
mistakesText.setText('Mistakes: 0/3');
promptText.setText('');
promptText.alpha = 0;
// Reset all dancers to neutral
for (var i = 0; i < dancers.length; i++) {
dancers[i].setNeutral();
}
// Restart music and game timer
LK.playMusic('gameMusic');
promptTimer = LK.setInterval(function () {
showPrompt();
}, 2000);
// Start first prompt
LK.setTimeout(function () {
showPrompt();
}, 2000);
}
};
// Start the game
LK.playMusic('gameMusic');
LK.setTimeout(function () {
showPrompt();
}, 2000);
game.update = function () {
// Animate light beams
for (var i = 0; i < lightBeams.length; i++) {
var beam = lightBeams[i];
beam.alpha = 0.2 + Math.sin(LK.ticks * 0.05 + i) * 0.3;
beam.scaleX = 0.8 + Math.sin(LK.ticks * 0.03 + i) * 0.4;
}
// Animate confetti particles
for (var i = 0; i < confettiParticles.length; i++) {
var particle = confettiParticles[i];
particle.y += Math.sin(LK.ticks * 0.02 + i) * 2;
particle.x += Math.cos(LK.ticks * 0.015 + i) * 1;
particle.rotation += 0.02;
// Reset position if particle goes off screen
if (particle.y > 2800) {
particle.y = -50;
particle.x = Math.random() * 2048;
}
if (particle.x > 2100) {
particle.x = -50;
}
if (particle.x < -50) {
particle.x = 2100;
}
}
};
gri mor bir masa üzerinde tuşlar var dj stilinde. In-Game asset. 2d. High contrast. No shadows
etrafı sarı işleme çerçeveli beyaz. In-Game asset. 2d. High contrast. No shadows
dansöz kıyafetli ayakta duran elleri havada dans eden bir kedi. In-Game asset. 2d. High contrast. No shadows
bomb. In-Game asset. 2d. High contrast. No shadows