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;
});
/****
* 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 = [];
// 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.05) {
// 5% chance
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
if (!powerUpActive) {
var newSpeed = Math.min(5 + Math.floor(score / 100), 20); // Speed increases every 100 points
if (newSpeed > gameSpeed) {
gameSpeed = newSpeed;
// Update existing blocks' speed
for (var k = 0; k < blocks.length; k++) {
blocks[k].fallSpeed = gameSpeed;
}
}
}
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(LK.ticks / 1800), 15);
}, 5000);
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();
}
}
// Initialize game
updateLivesDisplay();
// Start spawning blocks
spawnTimer = LK.setInterval(function () {
if (powerUpActive !== 'slowmo') {
spawnBlock();
} else {
if (LK.ticks % 2 === 0) {
spawnBlock();
}
}
}, 1000);
// Difficulty now increases based on score, not time
// Game update loop
game.update = function () {
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
@@ -87,18 +87,18 @@
comboTxt.y = 100;
LK.gui.top.addChild(comboTxt);
// Lives display
var livesContainer = new Container();
-livesContainer.x = 150;
+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 * 70;
+ heart.x = -i * 50; // Reduced spacing to fit better
hearts.push(heart);
livesContainer.addChild(heart);
}
}
@@ -137,8 +137,19 @@
var points = block.points * Math.min(combo, 10);
score += points;
LK.setScore(score);
scoreTxt.setText('Score: ' + score);
+ // Increase speed based on score
+ if (!powerUpActive) {
+ var newSpeed = Math.min(5 + Math.floor(score / 100), 20); // Speed increases every 100 points
+ if (newSpeed > gameSpeed) {
+ gameSpeed = newSpeed;
+ // Update existing blocks' speed
+ for (var k = 0; k < blocks.length; k++) {
+ blocks[k].fallSpeed = gameSpeed;
+ }
+ }
+ }
if (combo > bestCombo) {
bestCombo = combo;
}
// Show combo
@@ -237,14 +248,9 @@
spawnBlock();
}
}
}, 1000);
-// Increase difficulty over time
-difficultyTimer = LK.setInterval(function () {
- if (!powerUpActive) {
- gameSpeed = Math.min(gameSpeed + 1, 15);
- }
-}, 30000);
+// Difficulty now increases based on score, not time
// Game update loop
game.update = function () {
for (var i = blocks.length - 1; i >= 0; i--) {
var block = blocks[i];