User prompt
astığımız adamın konumunu stand ve ipe göre yeniden ayarla
User prompt
adamı astığımızipin bağlı olduğu bir stand oluştur
User prompt
adamı astığımız ipin bağlı olduğu bir stand oluştur
User prompt
adamı astğımız ipin bağlı olduğu bir stand oluştur
User prompt
menüye girildiğinde ya da oyun bittiğinde menünnün arkasında kalan tuş takımı çalışmasın
User prompt
menüdeki ayarlar butonuna basınca gelen ekrana müzik ses ayarı ve genel ses ayarı ekle ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyunu duraklattığımızda "oyun bitti" ve cevap yerine "MENÜ" yazsın
User prompt
menüyü yukarıdan ve aşağıdan genişlet ve menüye devam et butonu ekle. menüye basıldığında oyun duraklasın ve devam et tuşun basıldığında devam etsin
User prompt
oyunun sonunda çıkan menüye oyun içindeyken erişebilmek için sağ üste menü tuşu ekle
User prompt
menü tuşlarına ses ekle
User prompt
ayarlar ve yapımcılar butonuna basıldığında gelen ekranda yazan "AYARLAR" ve "YAPIMCILAR" başlılarını gelen ekranın üstüne konumlandır
User prompt
yapımcılar ve ayarlar menüsündeki "AYARLAR" ve "YAPIMCILAR" yazılarını menünün en üstüne konumlandır
User prompt
ayarlar ve yapımcılar butonlarına basıldığında gelen ekranı menü ile orantılı boyutlara getir
User prompt
menü deki yazıları da iki kat büyült ve menüdeki objelerin arasındaki boşluklarıda iki kat arttır
User prompt
menüyü iki kat büyült ve oyun bitince menü dışındaki yerleri yarı saydam yap ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
konfetilerin boyutunu eski haline getir ve konfeti sayısını iki katına çıkar
User prompt
konfetileri büyült
User prompt
konfetiler ekranın sağından ve solundan orta yukarıya doğru dağılarak gitsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kazanınca sağdan ve soldan konfeti patlasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kelime ilgili her oyun başı bir ipucu ver. Örneğin cevap "kedi" ise ipucu "hayvan" ya da cevap"masa" ise ipucu"eşya" olmalı.
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var localPos = self.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 190
User prompt
oyun sona erdiğinde çıkacak bir arayüz yap. yeniden başlatma tuşu ayarlar tuşu ve credits tuşu bulunsun
User prompt
tahmin edilecek kelimeleri türk dil kurumu sözlüğünden rastgele seç
Code edit (1 edits merged)
Please save this source code
User prompt
Hangman Challenge
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Gallows = Container.expand(function () {
var self = Container.call(this);
var base = self.attachAsset('gallows', {
anchorX: 0.5,
anchorY: 1.0
});
var rope = self.attachAsset('rope', {
anchorX: 0.5,
anchorY: 0.0,
x: 100,
y: -380
});
self.bodyParts = [];
var head = LK.getAsset('head', {
anchorX: 0.5,
anchorY: 0.5,
x: 100,
y: -290
});
head.alpha = 0;
self.addChild(head);
self.bodyParts.push(head);
var body = LK.getAsset('body', {
anchorX: 0.5,
anchorY: 0.0,
x: 100,
y: -260
});
body.alpha = 0;
self.addChild(body);
self.bodyParts.push(body);
var leftArm = LK.getAsset('leftArm', {
anchorX: 1.0,
anchorY: 0.5,
x: 96,
y: -230
});
leftArm.alpha = 0;
leftArm.rotation = Math.PI / 4;
self.addChild(leftArm);
self.bodyParts.push(leftArm);
var rightArm = LK.getAsset('rightArm', {
anchorX: 0.0,
anchorY: 0.5,
x: 104,
y: -230
});
rightArm.alpha = 0;
rightArm.rotation = -Math.PI / 4;
self.addChild(rightArm);
self.bodyParts.push(rightArm);
var leftLeg = LK.getAsset('leftLeg', {
anchorX: 1.0,
anchorY: 0.5,
x: 96,
y: -160
});
leftLeg.alpha = 0;
leftLeg.rotation = Math.PI / 6;
self.addChild(leftLeg);
self.bodyParts.push(leftLeg);
var rightLeg = LK.getAsset('rightLeg', {
anchorX: 0.0,
anchorY: 0.5,
x: 104,
y: -160
});
rightLeg.alpha = 0;
rightLeg.rotation = -Math.PI / 6;
self.addChild(rightLeg);
self.bodyParts.push(rightLeg);
self.showBodyPart = function (partIndex) {
if (partIndex < self.bodyParts.length) {
self.bodyParts[partIndex].alpha = 1;
tween(self.bodyParts[partIndex], {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
onFinish: function onFinish() {
tween(self.bodyParts[partIndex], {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
}
});
}
};
return self;
});
var GameOverMenu = Container.expand(function (isWin) {
var self = Container.call(this);
// Semi-transparent background overlay
var overlay = LK.getAsset('menuOverlay', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.95,
scaleX: 2,
scaleY: 2
});
self.addChild(overlay);
// Title text
var titleText = new Text2(isWin ? 'TEBRİKLER!' : 'OYUN BİTTİ', {
size: 120,
fill: isWin ? 0x00AA00 : 0xAA0000
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -300;
self.addChild(titleText);
// Result text
var resultText = new Text2(isWin ? 'Kelimeyi doğru tahmin ettiniz!' : 'Kelime: ' + currentWord, {
size: 80,
fill: 0x333333
});
resultText.anchor.set(0.5, 0.5);
resultText.y = -160;
self.addChild(resultText);
// Restart button
var restartButton = LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
y: -20,
scaleX: 2,
scaleY: 2
});
self.addChild(restartButton);
var restartText = new Text2('YENİDEN BAŞLA', {
size: 60,
fill: 0xFFFFFF
});
restartText.anchor.set(0.5, 0.5);
restartText.y = -20;
self.addChild(restartText);
// Settings button
var settingsButton = LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 160,
scaleX: 2,
scaleY: 2
});
self.addChild(settingsButton);
var settingsText = new Text2('AYARLAR', {
size: 60,
fill: 0xFFFFFF
});
settingsText.anchor.set(0.5, 0.5);
settingsText.y = 160;
self.addChild(settingsText);
// Credits button
var creditsButton = LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 340,
scaleX: 2,
scaleY: 2
});
self.addChild(creditsButton);
var creditsText = new Text2('YAPIMCILAR', {
size: 60,
fill: 0xFFFFFF
});
creditsText.anchor.set(0.5, 0.5);
creditsText.y = 340;
self.addChild(creditsText);
// Button interactions
self.down = function (x, y, obj) {
// Use the x, y coordinates directly instead of complex coordinate conversion
// Check restart button
if (y >= -100 && y <= 60) {
LK.getSound('button').play();
restartGame();
}
// Check settings button
else if (y >= 80 && y <= 240) {
LK.getSound('button').play();
showSettings();
}
// Check credits button
else if (y >= 260 && y <= 420) {
LK.getSound('button').play();
showCredits();
}
};
return self;
});
var LetterButton = Container.expand(function (letter) {
var self = Container.call(this);
self.letter = letter;
self.isUsed = false;
var buttonBg = self.attachAsset('letterButton', {
anchorX: 0.5,
anchorY: 0.5
});
var letterText = new Text2(letter.toUpperCase(), {
size: 40,
fill: 0xFFFFFF
});
letterText.anchor.set(0.5, 0.5);
self.addChild(letterText);
self.markAsUsed = function () {
if (!self.isUsed) {
self.isUsed = true;
self.removeChild(buttonBg);
var usedBg = self.attachAsset('usedLetterButton', {
anchorX: 0.5,
anchorY: 0.5
});
letterText.tint = 0x999999;
}
};
self.down = function (x, y, obj) {
if (!self.isUsed) {
guessLetter(self.letter);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xF5F5F5
});
/****
* Game Code
****/
var wordCategories = {
'HAYVAN': {
words: ['AKREP', 'ASLAN', 'BALIK', 'BİZON', 'BÖCEK', 'ÇAKAL', 'DEVE', 'GEYIK', 'GÜVERCIN', 'HOROZ', 'KARTAL', 'KEDİ', 'KIRPI', 'KÖPEK', 'KUĞU', 'KURBAĞA', 'KURT', 'KUZU', 'LEOPAR', 'MAYMUN', 'ÖRDEK', 'PAPAĞAN', 'SALYANGOZ', 'TAVŞAN', 'TURNA', 'VAŞAK', 'ZEBRA'],
hint: 'HAYVAN'
},
'GIDA': {
words: ['ARMUT', 'BADEM', 'BÖREK', 'ÇORBA', 'DOMATES', 'ELMA', 'FASULYE', 'GÜVEÇ', 'HELVA', 'IZGARA', 'JAMBON', 'KAHVE', 'LAHMACUN', 'MEYVE', 'NOHUT', 'OMLET', 'PEYNIR', 'REÇEL', 'SALATA', 'TAVUK', 'ÜZÜM', 'VIŞNE', 'YOĞURT', 'ZEYTİN'],
hint: 'GIDA'
},
'EŞYA': {
words: ['ANAHTAR', 'BAVUL', 'ÇANTA', 'DOLAP', 'FINCAN', 'GÖZLÜK', 'HALKA', 'IBRIK', 'KALEM', 'LAMBA', 'MASA', 'PERDE', 'RADYO', 'SAAT', 'TELEFON', 'VAZO', 'YAZICI', 'ZINCIR'],
hint: 'EŞYA'
},
'DUYGU': {
words: ['AŞKA', 'BAHAR', 'CESARET', 'DOSTLUK', 'EMEK', 'FIKIR', 'GÜVEN', 'HAYAL', 'IŞIK', 'KORKU', 'LÜTUF', 'MUTLULUK', 'NEFRET', 'OZLEM', 'PIŞMANLIK', 'RAHAT', 'SEVGI', 'TATLILUK', 'UMUT', 'VICDAN', 'YAŞAM', 'ZEVK'],
hint: 'DUYGU/KAVRAM'
},
'MESLEK': {
words: ['AVUKAT', 'BERBER', 'CERRAH', 'DOKTOR', 'ELEKTRIKÇI', 'GARSON', 'HEMŞIRE', 'IŞÇI', 'JOKEY', 'KAPICI', 'LABORANT', 'MIMAR', 'NOTER', 'ÖĞRETMEN', 'PILOT', 'RESSAM', 'SÜRÜCÜ', 'TERZI', 'USTA', 'VETERINER', 'YAZAR', 'ZOOLOG'],
hint: 'MESLEK'
},
'MEKAN': {
words: ['BAHÇE', 'ÇARŞI', 'DERSHANE', 'ECZANE', 'FABRIKA', 'GALERİ', 'HASTANE', 'KAHVEHANE', 'LIMAN', 'MÜZE', 'OTOPARK', 'PLAZA', 'RESTORAN', 'STADYUM', 'TIYATRO', 'ÜNİVERSİTE', 'VİLLA', 'ZOO'],
hint: 'MEKAN'
},
'RENK': {
words: ['AÇIK', 'BEYAZ', 'EFLATUN', 'FÜME', 'GRİ', 'HAKI', 'INDIGO', 'KAHVE', 'LACİVERT', 'MAVI', 'NARİN', 'OPAK', 'PEMBE', 'RENK', 'SARMAL', 'TURQUAZ', 'ULTRAMARIN', 'VİOLE', 'YEMYEŞIL', 'ZEYTUNİ'],
hint: 'RENK/ŞEKİL'
},
'ULAŞIM': {
words: ['ARABA', 'BISIKLET', 'DOLMUŞ', 'EKSPRES', 'FERIBOT', 'GEMI', 'HELIKOPTER', 'JET', 'KAMYON', 'LİMUZİN', 'METRO', 'OTOBÜS', 'ROKET', 'SCOOTER', 'TAKSI', 'UÇAK', 'VAPUR', 'ZEPLİN'],
hint: 'ULAŞIM'
},
'TEKNOLOJİ': {
words: ['ALGORITMA', 'BLUETOOTH', 'DATABASE', 'EMAIL', 'FIRMWARE', 'HARDWARE', 'INTERNET', 'JAVA', 'KLAVYE', 'LAPTOP', 'MODEM', 'NETWORK', 'ONLINE', 'PROGRAM', 'ROUTER', 'SOFTWARE', 'TABLET', 'USB', 'VİRÜS', 'WİFİ'],
hint: 'TEKNOLOJİ'
},
'SPOR': {
words: ['ATLETIZM', 'BASKETBOL', 'ESKRİM', 'FUTBOL', 'GOLF', 'HALTER', 'KARATE', 'MARATON', 'NIŞAN', 'OLIMPIK', 'PENALTI', 'RUGBY', 'TENIS', 'VOLEYBOL', 'YOGA'],
hint: 'SPOR'
},
'SANAT': {
words: ['AKORD', 'BALE', 'CELLO', 'DANS', 'ESTETIK', 'FLÜT', 'GITAR', 'HEYKEL', 'JAZZ', 'KLASIK', 'MÜZIK', 'NOTA', 'OPERA', 'PIYANO', 'RITIM', 'SENFONI', 'TABLO', 'VİOLİN', 'YAYLI', 'ZURNA'],
hint: 'SANAT/MÜZİK'
}
};
var turkishWords = [];
var currentHint = '';
// Flatten all words from categories into single array
for (var category in wordCategories) {
turkishWords = turkishWords.concat(wordCategories[category].words);
}
function getWordWithHint() {
var selectedWord = turkishWords[Math.floor(Math.random() * turkishWords.length)];
// Find which category this word belongs to
for (var category in wordCategories) {
if (wordCategories[category].words.indexOf(selectedWord) !== -1) {
currentHint = wordCategories[category].hint;
break;
}
}
return selectedWord;
}
var currentWord = '';
var guessedLetters = [];
var wrongGuesses = 0;
var maxWrongGuesses = 6;
var gameOver = false;
var gallows;
var wordDisplay;
var letterButtons = [];
var statusText;
var hintDisplay;
function initializeGame() {
currentWord = getWordWithHint();
guessedLetters = [];
wrongGuesses = 0;
gameOver = false;
// Create gallows
gallows = game.addChild(new Gallows());
gallows.x = 300;
gallows.y = 600;
// Create hint display
hintDisplay = new Text2('İpucu: ' + currentHint, {
size: 40,
fill: 0x007ACC
});
hintDisplay.anchor.set(0.5, 0.5);
hintDisplay.x = 1024;
hintDisplay.y = 720;
game.addChild(hintDisplay);
// Create word display
wordDisplay = new Text2(getDisplayWord(), {
size: 80,
fill: 0x333333
});
wordDisplay.anchor.set(0.5, 0.5);
wordDisplay.x = 1024;
wordDisplay.y = 800;
game.addChild(wordDisplay);
// Create letter buttons
var alphabet = 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ';
var buttonStartX = 200;
var buttonStartY = 1200;
var buttonsPerRow = 6;
var buttonSpacing = 140;
var rowSpacing = 100;
for (var i = 0; i < alphabet.length; i++) {
var button = new LetterButton(alphabet[i]);
var row = Math.floor(i / buttonsPerRow);
var col = i % buttonsPerRow;
button.x = buttonStartX + col * buttonSpacing;
button.y = buttonStartY + row * rowSpacing;
letterButtons.push(button);
game.addChild(button);
}
// Create status text
statusText = new Text2('Harfleri tahmin edin!', {
size: 50,
fill: 0x666666
});
statusText.anchor.set(0.5, 0.5);
statusText.x = 1024;
statusText.y = 950;
game.addChild(statusText);
}
function getDisplayWord() {
var display = '';
for (var i = 0; i < currentWord.length; i++) {
var letter = currentWord[i];
if (guessedLetters.indexOf(letter) !== -1) {
display += letter + ' ';
} else {
display += '_ ';
}
}
return display.trim();
}
function guessLetter(letter) {
if (gameOver || guessedLetters.indexOf(letter) !== -1) {
return;
}
guessedLetters.push(letter);
// Find and mark button as used
for (var i = 0; i < letterButtons.length; i++) {
if (letterButtons[i].letter === letter) {
letterButtons[i].markAsUsed();
break;
}
}
if (currentWord.indexOf(letter) !== -1) {
// Correct guess
LK.getSound('correct').play();
statusText.setText('Doğru tahmin!');
statusText.tint = 0x00AA00;
// Check if word is complete
var wordComplete = true;
for (var i = 0; i < currentWord.length; i++) {
if (guessedLetters.indexOf(currentWord[i]) === -1) {
wordComplete = false;
break;
}
}
if (wordComplete) {
gameOver = true;
statusText.setText('Tebrikler! Kazandınız!');
LK.getSound('win').play();
createConfetti(); // Trigger confetti celebration
LK.setTimeout(function () {
showCustomGameOver(true);
}, 2000);
}
} else {
// Wrong guess
wrongGuesses++;
LK.getSound('wrong').play();
statusText.setText('Yanlış tahmin!');
statusText.tint = 0xAA0000;
gallows.showBodyPart(wrongGuesses - 1);
if (wrongGuesses >= maxWrongGuesses) {
gameOver = true;
statusText.setText('Kaybettiniz! Kelime: ' + currentWord);
LK.getSound('lose').play();
LK.setTimeout(function () {
showCustomGameOver(false);
}, 2000);
}
}
wordDisplay.setText(getDisplayWord());
// Reset status color after a delay
if (!gameOver) {
LK.setTimeout(function () {
statusText.setText('Harfleri tahmin edin!');
statusText.tint = 0x666666;
}, 1500);
}
}
var gameOverMenu;
var gameOverBackground;
function showCustomGameOver(isWin) {
// Create semi-transparent background overlay for entire screen
gameOverBackground = LK.getAsset('menuOverlay', {
anchorX: 0,
anchorY: 0,
alpha: 0.5,
scaleX: 4,
scaleY: 8
});
gameOverBackground.x = 0;
gameOverBackground.y = 0;
gameOverBackground.tint = 0x000000;
game.addChild(gameOverBackground);
gameOverMenu = game.addChild(new GameOverMenu(isWin));
gameOverMenu.x = 1024;
gameOverMenu.y = 1366;
}
function restartGame() {
if (gameOverMenu) {
game.removeChild(gameOverMenu);
gameOverMenu = null;
}
if (gameOverBackground) {
game.removeChild(gameOverBackground);
gameOverBackground = null;
}
// Clear confetti particles
for (var i = 0; i < confettiParticles.length; i++) {
if (confettiParticles[i].parent) {
game.removeChild(confettiParticles[i]);
}
}
confettiParticles = [];
// Clear existing game elements
game.removeChild(gallows);
game.removeChild(wordDisplay);
game.removeChild(hintDisplay);
game.removeChild(statusText);
for (var i = 0; i < letterButtons.length; i++) {
game.removeChild(letterButtons[i]);
}
letterButtons = [];
// Restart the game
initializeGame();
}
function showSettings() {
if (gameOverMenu) {
game.removeChild(gameOverMenu);
gameOverMenu = null;
}
var settingsMenu = game.addChild(new Container());
settingsMenu.x = 1024;
settingsMenu.y = 1366;
var settingsOverlay = LK.getAsset('menuOverlay', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.95,
scaleX: 2,
scaleY: 2
});
settingsMenu.addChild(settingsOverlay);
var settingsTitle = new Text2('AYARLAR', {
size: 100,
fill: 0x333333
});
settingsTitle.anchor.set(0.5, 0.5);
settingsTitle.y = -300;
settingsMenu.addChild(settingsTitle);
var settingsInfo = new Text2('Ses efektleri ve müzik\nayarları burada olacak', {
size: 60,
fill: 0x666666
});
settingsInfo.anchor.set(0.5, 0.5);
settingsInfo.y = -20;
settingsMenu.addChild(settingsInfo);
var backButton = LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 200,
scaleX: 2,
scaleY: 2
});
settingsMenu.addChild(backButton);
var backText = new Text2('GERİ', {
size: 60,
fill: 0xFFFFFF
});
backText.anchor.set(0.5, 0.5);
backText.y = 200;
settingsMenu.addChild(backText);
settingsMenu.down = function (x, y, obj) {
LK.getSound('button').play();
game.removeChild(settingsMenu);
gameOverMenu = game.addChild(new GameOverMenu(false));
gameOverMenu.x = 1024;
gameOverMenu.y = 1366;
};
}
function showCredits() {
if (gameOverMenu) {
game.removeChild(gameOverMenu);
gameOverMenu = null;
}
var creditsMenu = game.addChild(new Container());
creditsMenu.x = 1024;
creditsMenu.y = 1366;
var creditsOverlay = LK.getAsset('menuOverlay', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.95,
scaleX: 2,
scaleY: 2
});
creditsMenu.addChild(creditsOverlay);
var creditsTitle = new Text2('YAPIMCILAR', {
size: 100,
fill: 0x333333
});
creditsTitle.anchor.set(0.5, 0.5);
creditsTitle.y = -300;
creditsMenu.addChild(creditsTitle);
var creditsInfo = new Text2('Geliştirici: FRVR\nTasarım: Ava\nTürk Dil Kurumu Sözlüğü\nkullanılmıştır', {
size: 50,
fill: 0x666666
});
creditsInfo.anchor.set(0.5, 0.5);
creditsInfo.y = -40;
creditsMenu.addChild(creditsInfo);
var backButton = LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 240,
scaleX: 2,
scaleY: 2
});
creditsMenu.addChild(backButton);
var backText = new Text2('GERİ', {
size: 60,
fill: 0xFFFFFF
});
backText.anchor.set(0.5, 0.5);
backText.y = 240;
creditsMenu.addChild(backText);
creditsMenu.down = function (x, y, obj) {
LK.getSound('button').play();
game.removeChild(creditsMenu);
gameOverMenu = game.addChild(new GameOverMenu(false));
gameOverMenu.x = 1024;
gameOverMenu.y = 1366;
};
}
// Confetti system
var confettiParticles = [];
function createConfetti() {
// Clear any existing confetti
for (var i = 0; i < confettiParticles.length; i++) {
if (confettiParticles[i].parent) {
game.removeChild(confettiParticles[i]);
}
}
confettiParticles = [];
// Create confetti particles from left and right sides
var colors = [0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0xFFA726, 0x66BB6A, 0xAB47BC];
var centerX = 1024; // Center of screen
var centerTopY = 400; // Center-top target area
// Left side confetti
for (var i = 0; i < 30; i++) {
var confetti = LK.getAsset('letterButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
confetti.tint = colors[Math.floor(Math.random() * colors.length)];
confetti.x = Math.random() * 200; // Start from left edge
confetti.y = 1000 + Math.random() * 400; // Start from mid-screen height
confetti.rotation = Math.random() * Math.PI * 2; // Random initial rotation
confettiParticles.push(confetti);
game.addChild(confetti);
// Animate towards center-top with spread effect
var targetX = centerX + (Math.random() - 0.5) * 400; // Spread around center
var targetY = centerTopY + Math.random() * 200; // Spread around center-top
tween(confetti, {
x: targetX,
y: targetY,
rotation: confetti.rotation + (Math.random() - 0.5) * Math.PI * 4,
alpha: 0
}, {
duration: 1500 + Math.random() * 1000,
easing: tween.easeOut,
onFinish: function () {
if (this.parent) {
game.removeChild(this);
}
}.bind(confetti)
});
}
// Right side confetti
for (var i = 0; i < 30; i++) {
var confetti = LK.getAsset('letterButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
confetti.tint = colors[Math.floor(Math.random() * colors.length)];
confetti.x = 1848 + Math.random() * 200; // Start from right edge
confetti.y = 1000 + Math.random() * 400; // Start from mid-screen height
confetti.rotation = Math.random() * Math.PI * 2; // Random initial rotation
confettiParticles.push(confetti);
game.addChild(confetti);
// Animate towards center-top with spread effect
var targetX = centerX + (Math.random() - 0.5) * 400; // Spread around center
var targetY = centerTopY + Math.random() * 200; // Spread around center-top
tween(confetti, {
x: targetX,
y: targetY,
rotation: confetti.rotation + (Math.random() - 0.5) * Math.PI * 4,
alpha: 0
}, {
duration: 1500 + Math.random() * 1000,
easing: tween.easeOut,
onFinish: function () {
if (this.parent) {
game.removeChild(this);
}
}.bind(confetti)
});
}
}
// Initialize the game
initializeGame();
; ===================================================================
--- original.js
+++ change.js
@@ -177,16 +177,19 @@
self.down = function (x, y, obj) {
// Use the x, y coordinates directly instead of complex coordinate conversion
// Check restart button
if (y >= -100 && y <= 60) {
+ LK.getSound('button').play();
restartGame();
}
// Check settings button
else if (y >= 80 && y <= 240) {
+ LK.getSound('button').play();
showSettings();
}
// Check credits button
else if (y >= 260 && y <= 420) {
+ LK.getSound('button').play();
showCredits();
}
};
return self;
@@ -523,8 +526,9 @@
backText.anchor.set(0.5, 0.5);
backText.y = 200;
settingsMenu.addChild(backText);
settingsMenu.down = function (x, y, obj) {
+ LK.getSound('button').play();
game.removeChild(settingsMenu);
gameOverMenu = game.addChild(new GameOverMenu(false));
gameOverMenu.x = 1024;
gameOverMenu.y = 1366;
@@ -575,8 +579,9 @@
backText.anchor.set(0.5, 0.5);
backText.y = 240;
creditsMenu.addChild(backText);
creditsMenu.down = function (x, y, obj) {
+ LK.getSound('button').play();
game.removeChild(creditsMenu);
gameOverMenu = game.addChild(new GameOverMenu(false));
gameOverMenu.x = 1024;
gameOverMenu.y = 1366;