User prompt
Blok lar kendi etraflarında dönüyor aşağı gelmiyorlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Block lar aşağı düşmüyor
User prompt
Oyunu geliştir ve animasyon dahada akıcı olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Diller kısmını ekle 3 dil seçeneği olsun İngilizce Türkçe ve almanca ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Ses efektleri ekle
User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in undefined' in or related to this line: 'tween(hearts[h], {' Line Number: 599
User prompt
Daha akıcı gözükmesi için animasyon ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyuna müzik ekle telifsiz olsun
User prompt
Zor yazısı gözükmüyor mavi yaz
User prompt
Müzik ekle zorluk menüsü ekle blok lar biraz büyült ve oyunu geliştir
User prompt
Menü ekle oyunun ismi yazsın oyun ismi SÜMÜKLÜ ÇOCUK FİRARDA olsun ve oyunu biraz zorlaştır ve geliştirme
User prompt
Can barı ekrana sığmıyor ve biraz skor puanımız artıkça hızı artsın zorlarsan
Code edit (1 edits merged)
Please save this source code
User prompt
Tap Rush
Initial prompt
Basit bir mobil oyun yap
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Block = Container.expand(function () { var self = Container.call(this); self.blockType = 'normal'; self.fallSpeed = 5; self.points = 10; var blockGraphics = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); self.setColor = function (color) { blockGraphics.tint = color; }; self.setPowerUp = function (type) { self.blockType = type; self.removeChildren(); var powerupGraphics = self.attachAsset('powerupBlock', { anchorX: 0.5, anchorY: 0.5 }); self.points = 50; }; self.update = function () { self.y += self.fallSpeed; }; self.down = function (x, y, obj) { if (self.parent) { handleBlockTap(self); } }; return self; }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var MenuScreen = Container.expand(function () { var self = Container.call(this); // Background overlay var bg = self.attachAsset('menuBg', { width: 2048, height: 2732, color: 0x000000, shape: 'box', anchorX: 0, anchorY: 0 }); bg.alpha = 0.8; // Game title var titleTxt = new Text2('SÜMÜKLÜ ÇOCUK', { size: 120, fill: 0xFFFF00 }); titleTxt.anchor.set(0.5, 0.5); titleTxt.x = 1024; titleTxt.y = 600; self.addChild(titleTxt); var subtitleTxt = new Text2('FİRARDA', { size: 100, fill: 0xFF4444 }); subtitleTxt.anchor.set(0.5, 0.5); subtitleTxt.x = 1024; subtitleTxt.y = 750; self.addChild(subtitleTxt); // Difficulty selection var difficultyTxt = new Text2('Zorluk Seviyesi', { size: 70, fill: 0xFFFFFF }); difficultyTxt.anchor.set(0.5, 0.5); difficultyTxt.x = 1024; difficultyTxt.y = 950; self.addChild(difficultyTxt); // Easy button var easyBtn = self.attachAsset('startBtn', { width: 300, height: 100, color: 0x44FF44, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); easyBtn.x = 700; easyBtn.y = 1100; var easyTxt = new Text2('KOLAY', { size: 60, fill: 0x000000 }); easyTxt.anchor.set(0.5, 0.5); easyTxt.x = 700; easyTxt.y = 1100; self.addChild(easyTxt); // Medium button var mediumBtn = self.attachAsset('startBtn', { width: 300, height: 100, color: 0xFFFF44, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); mediumBtn.x = 1024; mediumBtn.y = 1100; var mediumTxt = new Text2('ORTA', { size: 60, fill: 0x000000 }); mediumTxt.anchor.set(0.5, 0.5); mediumTxt.x = 1024; mediumTxt.y = 1100; self.addChild(mediumTxt); // Hard button var hardBtn = self.attachAsset('startBtn', { width: 300, height: 100, color: 0xFF4444, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); hardBtn.x = 1348; hardBtn.y = 1100; var hardTxt = new Text2('ZOR', { size: 60, fill: 0x4444FF }); hardTxt.anchor.set(0.5, 0.5); hardTxt.x = 1348; hardTxt.y = 1100; self.addChild(hardTxt); // Start button var startBtn = self.attachAsset('startBtn', { width: 400, height: 150, color: 0x44FF44, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); startBtn.x = 1024; startBtn.y = 1400; var startTxt = new Text2('BAŞLA', { size: 80, fill: 0x000000 }); startTxt.anchor.set(0.5, 0.5); startTxt.x = 1024; startTxt.y = 1400; self.addChild(startTxt); // High score display var highScoreTxt = new Text2('En Yüksek Skor: 0', { size: 60, fill: 0xFFFFFF }); highScoreTxt.anchor.set(0.5, 0.5); highScoreTxt.x = 1024; highScoreTxt.y = 1700; self.addChild(highScoreTxt); // Selected difficulty var selectedDifficulty = 1; // 0=easy, 1=medium, 2=hard var selectedTxt = new Text2('Seçilen: ORTA', { size: 50, fill: 0xFFFF00 }); selectedTxt.anchor.set(0.5, 0.5); selectedTxt.x = 1024; selectedTxt.y = 1250; self.addChild(selectedTxt); self.updateHighScore = function () { var highScore = storage.highScore || 0; highScoreTxt.setText('En Yüksek Skor: ' + highScore); }; easyBtn.down = function () { selectedDifficulty = 0; selectedTxt.setText('Seçilen: KOLAY'); easyBtn.tint = 0xAAFFAA; mediumBtn.tint = 0xFFFFFF; hardBtn.tint = 0xFFFFFF; // Animate button press tween(easyBtn, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(easyBtn, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); }; mediumBtn.down = function () { selectedDifficulty = 1; selectedTxt.setText('Seçilen: ORTA'); easyBtn.tint = 0xFFFFFF; mediumBtn.tint = 0xFFFFAA; hardBtn.tint = 0xFFFFFF; // Animate button press tween(mediumBtn, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(mediumBtn, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); }; hardBtn.down = function () { selectedDifficulty = 2; selectedTxt.setText('Seçilen: ZOR'); easyBtn.tint = 0xFFFFFF; mediumBtn.tint = 0xFFFFFF; hardBtn.tint = 0xFFAAAA; // Animate button press tween(hardBtn, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(hardBtn, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); }; startBtn.down = function () { // Animate start button tween(startBtn, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(startBtn, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); if (self.onStart) { self.onStart(selectedDifficulty); } }; // Set initial selection highlight mediumBtn.tint = 0xFFFFAA; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ // Game variables var blocks = []; var lives = 3; var score = 0; var combo = 0; var bestCombo = 0; var gameSpeed = 5; var powerUpActive = null; var powerUpTimer = null; var difficultyTimer = null; var spawnTimer = null; var hearts = []; var gameStarted = false; var menuScreen = null; var gameDifficulty = 1; // 0=easy, 1=medium, 2=hard var difficultySettings = { 0: { startSpeed: 3, maxSpeed: 15, spawnRate: 1000, powerUpChance: 0.05 }, // Easy 1: { startSpeed: 5, maxSpeed: 25, spawnRate: 800, powerUpChance: 0.03 }, // Medium 2: { startSpeed: 8, maxSpeed: 35, spawnRate: 600, powerUpChance: 0.02 } // Hard }; // Block colors var blockColors = [0xff4444, 0x44ff44, 0x4444ff, 0xff44ff, 0x44ffff]; var powerUpTypes = ['slowmo', 'clear', 'extralife']; // UI Elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var comboTxt = new Text2('', { size: 60, fill: 0xFFFF00 }); comboTxt.anchor.set(0.5, 0); comboTxt.y = 100; LK.gui.top.addChild(comboTxt); // Lives display var livesContainer = new Container(); livesContainer.x = -50; // Moved left to ensure hearts stay on screen livesContainer.y = 50; LK.gui.topRight.addChild(livesContainer); // Initialize hearts function updateLivesDisplay() { livesContainer.removeChildren(); hearts = []; for (var i = 0; i < lives; i++) { var heart = new Heart(); heart.x = -i * 50; // Reduced spacing to fit better hearts.push(heart); livesContainer.addChild(heart); } } // Game functions function spawnBlock() { var block = new Block(); block.x = Math.random() * (2048 - 200) + 100; block.y = -100; // Random chance for power-up if (Math.random() < difficultySettings[gameDifficulty].powerUpChance) { // Power-up chance based on difficulty var powerUpType = powerUpTypes[Math.floor(Math.random() * powerUpTypes.length)]; block.setPowerUp(powerUpType); } else { // Normal block with random color var color = blockColors[Math.floor(Math.random() * blockColors.length)]; block.setColor(color); } block.fallSpeed = gameSpeed; blocks.push(block); game.addChild(block); // Add spawn animation block.scaleX = 0; block.scaleY = 0; tween(block, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.elasticOut }); } function handleBlockTap(block) { var index = blocks.indexOf(block); if (index > -1) { blocks.splice(index, 1); // Handle power-ups if (block.blockType !== 'normal') { activatePowerUp(block.blockType); LK.getSound('powerup').play(); } else { LK.getSound('tap').play(); } // Update score and combo combo++; var points = block.points * Math.min(combo, 10); score += points; LK.setScore(score); scoreTxt.setText('Score: ' + score); // Animate score text tween(scoreTxt, { scaleX: 1.1, scaleY: 1.1 }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(scoreTxt, { scaleX: 1, scaleY: 1 }, { duration: 150, easing: tween.easeIn }); } }); // Increase speed based on score - more aggressive scaling if (!powerUpActive) { var settings = difficultySettings[gameDifficulty]; var newSpeed = Math.min(settings.startSpeed + Math.floor(score / 50), settings.maxSpeed); if (newSpeed > gameSpeed) { gameSpeed = newSpeed; // Update existing blocks' speed for (var k = 0; k < blocks.length; k++) { blocks[k].fallSpeed = gameSpeed; } } } // Spawn extra blocks at higher scores if (score > 200 && Math.random() < 0.3) { LK.setTimeout(function () { if (gameStarted) { spawnBlock(); } }, 200); } if (combo > bestCombo) { bestCombo = combo; } // Show combo if (combo > 1) { comboTxt.setText('Combo x' + combo); // Animate combo text comboTxt.scaleX = 1.3; comboTxt.scaleY = 1.3; tween(comboTxt, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.bounceOut }); if (combo % 5 === 0) { LK.getSound('combo').play(); } } // Visual feedback LK.effects.flashObject(block, 0xffffff, 200); // Animate block disappearing tween(block, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 200, easing: tween.easeOut }); // Remove block after animation LK.setTimeout(function () { if (block.parent) { block.destroy(); } }, 200); } } function activatePowerUp(type) { if (powerUpTimer) { LK.clearTimeout(powerUpTimer); } // Flash and scale effect for power-up activation for (var p = 0; p < blocks.length; p++) { if (blocks[p].blockType === 'normal') { tween(blocks[p], { scaleX: 0.9, scaleY: 0.9 }, { duration: 200, easing: tween.easeInOut, onFinish: function (b) { return function () { tween(b, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeInOut }); }; }(blocks[p]) }); } } switch (type) { case 'slowmo': powerUpActive = 'slowmo'; gameSpeed = 2; for (var i = 0; i < blocks.length; i++) { blocks[i].fallSpeed = gameSpeed; } powerUpTimer = LK.setTimeout(function () { powerUpActive = null; var settings = difficultySettings[gameDifficulty]; gameSpeed = Math.min(settings.startSpeed + Math.floor(score / 50), settings.maxSpeed); }, 3000); // Reduced from 5000 to 3000 break; case 'clear': var clearDelay = 0; for (var j = blocks.length - 1; j >= 0; j--) { var block = blocks[j]; if (block.blockType === 'normal') { LK.effects.flashObject(block, 0xffffff, 300); blocks.splice(j, 1); // Staggered clear animation LK.setTimeout(function (b, delay) { return function () { tween(b, { scaleX: 0, scaleY: 0, rotation: Math.PI }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { if (b.parent) { b.destroy(); } } }); }; }(block, clearDelay), clearDelay); clearDelay += 50; // Stagger by 50ms score += 5; } } LK.setScore(score); scoreTxt.setText('Score: ' + score); break; case 'extralife': if (lives < 5) { lives++; updateLivesDisplay(); } else { score += 100; LK.setScore(score); scoreTxt.setText('Score: ' + score); } break; } } function missBlock() { lives--; combo = 0; comboTxt.setText(''); LK.getSound('miss').play(); // Animate hearts before updating for (var h = 0; h < hearts.length; h++) { tween(hearts[h], { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(hearts[h], { scaleX: 1, scaleY: 1 }, { duration: 150, easing: tween.easeIn }); } }); } updateLivesDisplay(); // Flash screen red LK.effects.flashScreen(0xff0000, 500); if (lives <= 0) { // Save high score var highScore = storage.highScore || 0; if (score > highScore) { storage.highScore = score; } var bestComboSaved = storage.bestCombo || 0; if (bestCombo > bestComboSaved) { storage.bestCombo = bestCombo; } LK.showGameOver(); LK.setTimeout(function () { showMenu(); }, 2000); } } // Initialize game function startGame(difficulty) { gameStarted = true; gameDifficulty = difficulty || 1; var settings = difficultySettings[gameDifficulty]; lives = 3; score = 0; combo = 0; bestCombo = 0; gameSpeed = settings.startSpeed; blocks = []; powerUpActive = null; if (menuScreen && menuScreen.parent) { menuScreen.destroy(); } updateLivesDisplay(); scoreTxt.setText('Score: 0'); comboTxt.setText(''); // Play background music when game starts LK.playMusic('gameMusic', { volume: 0.5 }); // Start spawning blocks spawnTimer = LK.setInterval(function () { if (powerUpActive !== 'slowmo') { spawnBlock(); } else { if (LK.ticks % 2 === 0) { spawnBlock(); } } }, difficultySettings[gameDifficulty].spawnRate); } // Show menu on start function showMenu() { gameStarted = false; // Stop music when returning to menu LK.stopMusic(); // Clear any existing game state if (spawnTimer) { LK.clearInterval(spawnTimer); spawnTimer = null; } // Clear all blocks for (var i = blocks.length - 1; i >= 0; i--) { blocks[i].destroy(); } blocks = []; menuScreen = new MenuScreen(); menuScreen.updateHighScore(); menuScreen.onStart = function (difficulty) { startGame(difficulty); }; game.addChild(menuScreen); } // Show menu initially showMenu(); // Difficulty now increases based on score, not time // Game update loop game.update = function () { if (!gameStarted) return; for (var i = blocks.length - 1; i >= 0; i--) { var block = blocks[i]; // Check if block reached bottom if (block.y > 2732 + 100) { blocks.splice(i, 1); block.destroy(); if (block.blockType === 'normal') { missBlock(); } } } };
===================================================================
--- original.js
+++ change.js
@@ -188,24 +188,92 @@
selectedTxt.setText('Seçilen: KOLAY');
easyBtn.tint = 0xAAFFAA;
mediumBtn.tint = 0xFFFFFF;
hardBtn.tint = 0xFFFFFF;
+ // Animate button press
+ tween(easyBtn, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(easyBtn, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ }
+ });
};
mediumBtn.down = function () {
selectedDifficulty = 1;
selectedTxt.setText('Seçilen: ORTA');
easyBtn.tint = 0xFFFFFF;
mediumBtn.tint = 0xFFFFAA;
hardBtn.tint = 0xFFFFFF;
+ // Animate button press
+ tween(mediumBtn, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(mediumBtn, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ }
+ });
};
hardBtn.down = function () {
selectedDifficulty = 2;
selectedTxt.setText('Seçilen: ZOR');
easyBtn.tint = 0xFFFFFF;
mediumBtn.tint = 0xFFFFFF;
hardBtn.tint = 0xFFAAAA;
+ // Animate button press
+ tween(hardBtn, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(hardBtn, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ }
+ });
};
startBtn.down = function () {
+ // Animate start button
+ tween(startBtn, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(startBtn, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100,
+ easing: tween.easeOut
+ });
+ }
+ });
if (self.onStart) {
self.onStart(selectedDifficulty);
}
};
@@ -311,8 +379,18 @@
}
block.fallSpeed = gameSpeed;
blocks.push(block);
game.addChild(block);
+ // Add spawn animation
+ block.scaleX = 0;
+ block.scaleY = 0;
+ tween(block, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 300,
+ easing: tween.elasticOut
+ });
}
function handleBlockTap(block) {
var index = blocks.indexOf(block);
if (index > -1) {
@@ -329,8 +407,25 @@
var points = block.points * Math.min(combo, 10);
score += points;
LK.setScore(score);
scoreTxt.setText('Score: ' + score);
+ // Animate score text
+ tween(scoreTxt, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 150,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(scoreTxt, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 150,
+ easing: tween.easeIn
+ });
+ }
+ });
// Increase speed based on score - more aggressive scaling
if (!powerUpActive) {
var settings = difficultySettings[gameDifficulty];
var newSpeed = Math.min(settings.startSpeed + Math.floor(score / 50), settings.maxSpeed);
@@ -355,15 +450,34 @@
}
// Show combo
if (combo > 1) {
comboTxt.setText('Combo x' + combo);
+ // Animate combo text
+ comboTxt.scaleX = 1.3;
+ comboTxt.scaleY = 1.3;
+ tween(comboTxt, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 300,
+ easing: tween.bounceOut
+ });
if (combo % 5 === 0) {
LK.getSound('combo').play();
}
}
// Visual feedback
LK.effects.flashObject(block, 0xffffff, 200);
- // Remove block after flash
+ // Animate block disappearing
+ tween(block, {
+ scaleX: 1.5,
+ scaleY: 1.5,
+ alpha: 0
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ // Remove block after animation
LK.setTimeout(function () {
if (block.parent) {
block.destroy();
}
@@ -373,8 +487,31 @@
function activatePowerUp(type) {
if (powerUpTimer) {
LK.clearTimeout(powerUpTimer);
}
+ // Flash and scale effect for power-up activation
+ for (var p = 0; p < blocks.length; p++) {
+ if (blocks[p].blockType === 'normal') {
+ tween(blocks[p], {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 200,
+ easing: tween.easeInOut,
+ onFinish: function (b) {
+ return function () {
+ tween(b, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 200,
+ easing: tween.easeInOut
+ });
+ };
+ }(blocks[p])
+ });
+ }
+ }
switch (type) {
case 'slowmo':
powerUpActive = 'slowmo';
gameSpeed = 2;
@@ -387,20 +524,33 @@
gameSpeed = Math.min(settings.startSpeed + Math.floor(score / 50), settings.maxSpeed);
}, 3000); // Reduced from 5000 to 3000
break;
case 'clear':
+ var clearDelay = 0;
for (var j = blocks.length - 1; j >= 0; j--) {
var block = blocks[j];
if (block.blockType === 'normal') {
LK.effects.flashObject(block, 0xffffff, 300);
blocks.splice(j, 1);
- LK.setTimeout(function (b) {
+ // Staggered clear animation
+ LK.setTimeout(function (b, delay) {
return function () {
- if (b.parent) {
- b.destroy();
- }
+ tween(b, {
+ scaleX: 0,
+ scaleY: 0,
+ rotation: Math.PI
+ }, {
+ duration: 300,
+ easing: tween.easeIn,
+ onFinish: function onFinish() {
+ if (b.parent) {
+ b.destroy();
+ }
+ }
+ });
};
- }(block), 300);
+ }(block, clearDelay), clearDelay);
+ clearDelay += 50; // Stagger by 50ms
score += 5;
}
}
LK.setScore(score);
@@ -422,8 +572,27 @@
lives--;
combo = 0;
comboTxt.setText('');
LK.getSound('miss').play();
+ // Animate hearts before updating
+ for (var h = 0; h < hearts.length; h++) {
+ tween(hearts[h], {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 150,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(hearts[h], {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 150,
+ easing: tween.easeIn
+ });
+ }
+ });
+ }
updateLivesDisplay();
// Flash screen red
LK.effects.flashScreen(0xff0000, 500);
if (lives <= 0) {