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 = 800; 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; self.addChild(subtitleTxt); // 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); self.updateHighScore = function () { var highScore = storage.highScore || 0; highScoreTxt.setText('En Yüksek Skor: ' + highScore); }; startBtn.down = function () { if (self.onStart) { self.onStart(); } }; 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; // 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 - 150) + 75; block.y = -75; // Random chance for power-up if (Math.random() < 0.03) { // 3% chance - reduced for more 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 newSpeed = Math.min(5 + Math.floor(score / 50), 25); // Speed increases every 50 points, max 25 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; gameSpeed = Math.min(5 + Math.floor(score / 50), 25); }, 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() { gameStarted = true; lives = 3; score = 0; combo = 0; bestCombo = 0; gameSpeed = 5; 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(); } } }, 800); // Faster spawn rate for more difficulty } // 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 = startGame; 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 + 75) { blocks.splice(i, 1); block.destroy(); if (block.blockType === 'normal') { missBlock(); } } } }; // Play background music LK.playMusic('gameMusic');
===================================================================
--- original.js
+++ change.js
@@ -45,8 +45,76 @@
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 = 800;
+ 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;
+ self.addChild(subtitleTxt);
+ // 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);
+ self.updateHighScore = function () {
+ var highScore = storage.highScore || 0;
+ highScoreTxt.setText('En Yüksek Skor: ' + highScore);
+ };
+ startBtn.down = function () {
+ if (self.onStart) {
+ self.onStart();
+ }
+ };
+ return self;
+});
/****
* Initialize Game
****/
@@ -68,8 +136,10 @@
var powerUpTimer = null;
var difficultyTimer = null;
var spawnTimer = null;
var hearts = [];
+var gameStarted = false;
+var menuScreen = null;
// Block colors
var blockColors = [0xff4444, 0x44ff44, 0x4444ff, 0xff44ff, 0x44ffff];
var powerUpTypes = ['slowmo', 'clear', 'extralife'];
// UI Elements
@@ -107,10 +177,10 @@
var block = new Block();
block.x = Math.random() * (2048 - 150) + 75;
block.y = -75;
// Random chance for power-up
- if (Math.random() < 0.05) {
- // 5% chance
+ if (Math.random() < 0.03) {
+ // 3% chance - reduced for more difficulty
var powerUpType = powerUpTypes[Math.floor(Math.random() * powerUpTypes.length)];
block.setPowerUp(powerUpType);
} else {
// Normal block with random color
@@ -137,19 +207,27 @@
var points = block.points * Math.min(combo, 10);
score += points;
LK.setScore(score);
scoreTxt.setText('Score: ' + score);
- // Increase speed based on score
+ // Increase speed based on score - more aggressive scaling
if (!powerUpActive) {
- var newSpeed = Math.min(5 + Math.floor(score / 100), 20); // Speed increases every 100 points
+ var newSpeed = Math.min(5 + Math.floor(score / 50), 25); // Speed increases every 50 points, max 25
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
@@ -181,10 +259,10 @@
blocks[i].fallSpeed = gameSpeed;
}
powerUpTimer = LK.setTimeout(function () {
powerUpActive = null;
- gameSpeed = Math.min(5 + Math.floor(LK.ticks / 1800), 15);
- }, 5000);
+ gameSpeed = Math.min(5 + Math.floor(score / 50), 25);
+ }, 3000); // Reduced from 5000 to 3000
break;
case 'clear':
for (var j = blocks.length - 1; j >= 0; j--) {
var block = blocks[j];
@@ -234,25 +312,64 @@
if (bestCombo > bestComboSaved) {
storage.bestCombo = bestCombo;
}
LK.showGameOver();
+ LK.setTimeout(function () {
+ showMenu();
+ }, 2000);
}
}
// Initialize game
-updateLivesDisplay();
-// Start spawning blocks
-spawnTimer = LK.setInterval(function () {
- if (powerUpActive !== 'slowmo') {
- spawnBlock();
- } else {
- if (LK.ticks % 2 === 0) {
+function startGame() {
+ gameStarted = true;
+ lives = 3;
+ score = 0;
+ combo = 0;
+ bestCombo = 0;
+ gameSpeed = 5;
+ 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();
+ }
}
+ }, 800); // Faster spawn rate for more difficulty
+}
+// Show menu on start
+function showMenu() {
+ gameStarted = false;
+ // Clear any existing game state
+ if (spawnTimer) {
+ LK.clearInterval(spawnTimer);
+ spawnTimer = null;
}
-}, 1000);
+ // Clear all blocks
+ for (var i = blocks.length - 1; i >= 0; i--) {
+ blocks[i].destroy();
+ }
+ blocks = [];
+ menuScreen = new MenuScreen();
+ menuScreen.updateHighScore();
+ menuScreen.onStart = startGame;
+ 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 + 75) {