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: 0xFFFFFF }); 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; }; mediumBtn.down = function () { selectedDifficulty = 1; selectedTxt.setText('Seçilen: ORTA'); easyBtn.tint = 0xFFFFFF; mediumBtn.tint = 0xFFFFAA; hardBtn.tint = 0xFFFFFF; }; hardBtn.down = function () { selectedDifficulty = 2; selectedTxt.setText('Seçilen: ZOR'); easyBtn.tint = 0xFFFFFF; mediumBtn.tint = 0xFFFFFF; hardBtn.tint = 0xFFAAAA; }; startBtn.down = function () { 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); } 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); // 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); if (combo % 5 === 0) { LK.getSound('combo').play(); } } // Visual feedback LK.effects.flashObject(block, 0xffffff, 200); // Remove block after flash LK.setTimeout(function () { if (block.parent) { block.destroy(); } }, 200); } } function activatePowerUp(type) { if (powerUpTimer) { LK.clearTimeout(powerUpTimer); } 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': 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) { return function () { if (b.parent) { b.destroy(); } }; }(block), 300); 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(); 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(''); // 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; // 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(); } } } }; // Play background music LK.playMusic('gameMusic');
===================================================================
--- original.js
+++ change.js
@@ -64,18 +64,84 @@
fill: 0xFFFF00
});
titleTxt.anchor.set(0.5, 0.5);
titleTxt.x = 1024;
- titleTxt.y = 800;
+ 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 = 950;
+ 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: 0xFFFFFF
+ });
+ 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,
@@ -102,17 +168,50 @@
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;
+ };
+ mediumBtn.down = function () {
+ selectedDifficulty = 1;
+ selectedTxt.setText('Seçilen: ORTA');
+ easyBtn.tint = 0xFFFFFF;
+ mediumBtn.tint = 0xFFFFAA;
+ hardBtn.tint = 0xFFFFFF;
+ };
+ hardBtn.down = function () {
+ selectedDifficulty = 2;
+ selectedTxt.setText('Seçilen: ZOR');
+ easyBtn.tint = 0xFFFFFF;
+ mediumBtn.tint = 0xFFFFFF;
+ hardBtn.tint = 0xFFAAAA;
+ };
startBtn.down = function () {
if (self.onStart) {
- self.onStart();
+ self.onStart(selectedDifficulty);
}
};
+ // Set initial selection highlight
+ mediumBtn.tint = 0xFFFFAA;
return self;
});
/****
@@ -138,8 +237,31 @@
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
@@ -174,13 +296,13 @@
}
// Game functions
function spawnBlock() {
var block = new Block();
- block.x = Math.random() * (2048 - 150) + 75;
- block.y = -75;
+ block.x = Math.random() * (2048 - 200) + 100;
+ block.y = -100;
// Random chance for power-up
- if (Math.random() < 0.03) {
- // 3% chance - reduced for more difficulty
+ 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
@@ -209,9 +331,10 @@
LK.setScore(score);
scoreTxt.setText('Score: ' + score);
// Increase speed based on score - more aggressive scaling
if (!powerUpActive) {
- var newSpeed = Math.min(5 + Math.floor(score / 50), 25); // Speed increases every 50 points, max 25
+ 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++) {
@@ -259,9 +382,10 @@
blocks[i].fallSpeed = gameSpeed;
}
powerUpTimer = LK.setTimeout(function () {
powerUpActive = null;
- gameSpeed = Math.min(5 + Math.floor(score / 50), 25);
+ var settings = difficultySettings[gameDifficulty];
+ gameSpeed = Math.min(settings.startSpeed + Math.floor(score / 50), settings.maxSpeed);
}, 3000); // Reduced from 5000 to 3000
break;
case 'clear':
for (var j = blocks.length - 1; j >= 0; j--) {
@@ -318,15 +442,17 @@
}, 2000);
}
}
// Initialize game
-function startGame() {
+function startGame(difficulty) {
gameStarted = true;
+ gameDifficulty = difficulty || 1;
+ var settings = difficultySettings[gameDifficulty];
lives = 3;
score = 0;
combo = 0;
bestCombo = 0;
- gameSpeed = 5;
+ gameSpeed = settings.startSpeed;
blocks = [];
powerUpActive = null;
if (menuScreen && menuScreen.parent) {
menuScreen.destroy();
@@ -342,9 +468,9 @@
if (LK.ticks % 2 === 0) {
spawnBlock();
}
}
- }, 800); // Faster spawn rate for more difficulty
+ }, difficultySettings[gameDifficulty].spawnRate);
}
// Show menu on start
function showMenu() {
gameStarted = false;
@@ -359,9 +485,11 @@
}
blocks = [];
menuScreen = new MenuScreen();
menuScreen.updateHighScore();
- menuScreen.onStart = startGame;
+ menuScreen.onStart = function (difficulty) {
+ startGame(difficulty);
+ };
game.addChild(menuScreen);
}
// Show menu initially
showMenu();
@@ -371,9 +499,9 @@
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 + 75) {
+ if (block.y > 2732 + 100) {
blocks.splice(i, 1);
block.destroy();
if (block.blockType === 'normal') {
missBlock();