User prompt
bukalemunun üzerinde olan hangi topu atacağını gösteren top simgesi bukalemundan biraz üst tarafa doğru kaysın. belki ona özel bir kutucukta güzel olabilir
User prompt
ortada olan bukalemunun üzerinde olan göndereceği top görseli aşağısında bir kutucuğun içinde gözüksün.
User prompt
2x büyük olacak top ekranın ortalarından aynı renk 3 adet top atılana kadar kalsın
User prompt
2x olan top yenilene kadar ekranda kalsın ve diğer toplardan en 5x yavaş hareket etsin.
User prompt
2x büyük oluşan top uzun süre ekranda kalsın ve 2x çıkan top ancak 3 top darbesi ile yenilsin.
User prompt
3 tane aynı renk top vurunca (ard arda olması gerekmez 3 tane aynı renkten farklı zamanlardada vurulsa olur) combo 2x boyutlu rastgele bi top gelsin.
User prompt
aynı renge 5 ayrı zamanda da vuruş olsa bu combo sayılsın ve 2 katı büyük ve 50 puan değerinde büyük hali gelsin
User prompt
Her doğru vuruştan sonra (kombo stili) ortaya çıkan top sayısını artırın. ve ortaya çıkan toplar çokça olsun ve çok yavaş hareket etsin aynı toptan 5 defa vurduğumuzda 5 defa vurduğumuz topun 1 katı büyük top gelsin.
User prompt
vuruştan sonra combo gibi ortaya çıkan toplarda yavaş hareket edenlerden olsun
User prompt
ekran tamamen boşaldığında oyun bitsin. topları doğru vurdukça daha çok top gelsin combo gibi
User prompt
mor top çok fazla puan getiriyor. mor topu mor topu vuduğumuzda 20 puan score alınsın.
User prompt
toplar yendiğinde çıkan efekti düz bir efektle değiştir. top yendiğinde düz bir efekt olsun
User prompt
top yenildiğinde yenilen top hangisi ise onun görüntüsü çıksın
User prompt
mor renkli top bir süre daha fazla döngüye girmeye başlasın ve karmaşık düzende olsun bütün toplar
User prompt
toplar sürekli bir döngüde olsun ve sürekli gelsin taki score u sıfırlayana kadar
User prompt
puanlandırma biçimi ve mor topu yediğimizde daha çok ve karışık biçimde toplar gelsin
User prompt
oyun çabuk bitiyor buna bir çözüm üretilsin
User prompt
toplar daha değişik şekilde ve farklı zamanlarda daha çok gelsin ve beklenmedik anlarda gelsin
User prompt
daha fazla top gelmeye devam etsin
User prompt
Please fix the bug: 'Uncaught ReferenceError: tween is not defined' in or related to this line: 'tween(projectile.projectileGraphics, {' Line Number: 216 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Uncaught ReferenceError: tween is not defined' in or related to this line: 'tween(projectile.projectileGraphics, {' Line Number: 216 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
bukalemunun arkasında olan yanıp sönen efekti ve eklentiyi kaldıralım
User prompt
oyunun arka planını düz ama yeşillikli bişey olsun istiyorum
User prompt
toplar biraz daha çok olsun ve oyun hemen bitmesin
User prompt
müzik kısmına eklediğim müziği eklemek istiyorum amazon adı
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Ball = Container.expand(function (color) {
var self = Container.call(this);
self.ballColor = color || 'red';
self.ballGraphics = self.attachAsset('ball_' + self.ballColor, {
anchorX: 0.5,
anchorY: 0.5
});
self.chainIndex = 0;
self.pathPosition = 0;
self.isExploding = false;
self.isBigComboBall = false; // Default: not a big combo ball
self.lastPathPosition = 0;
self.isOffScreen = false;
self.lastX = 0;
self.lastY = 0;
self.checkOffScreen = function () {
// Check if ball has moved completely off screen
var margin = 100; // Extra margin to ensure ball is truly gone
var wasOnScreen = self.lastX >= -margin && self.lastX <= 2048 + margin && self.lastY >= -margin && self.lastY <= 2732 + margin;
var isNowOffScreen = self.x < -margin || self.x > 2048 + margin || self.y < -margin || self.y > 2732 + margin;
// Detect transition from on-screen to off-screen
if (wasOnScreen && isNowOffScreen && !self.isOffScreen) {
self.isOffScreen = true;
}
// Update last known positions
self.lastX = self.x;
self.lastY = self.y;
};
self.explode = function () {
if (self.isExploding) return;
self.isExploding = true;
tween(self.ballGraphics, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
if (self.parent) {
self.parent.removeChild(self);
}
}
});
LK.getSound('explosion').play();
};
self.destroyOnHit = function () {
// Simple effect: fade out the ballGraphics and remove the ball
tween(self.ballGraphics, {
alpha: 0
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
if (self.parent) {
self.parent.removeChild(self);
}
}
});
// Purple balls require multiple hits, others destroyed immediately
if (self.ballColor === 'purple') {
if (!self.hitCount) self.hitCount = 0;
self.hitCount++;
if (self.hitCount >= 2) {
// Mor top tamamen yok edildiğinde: bir kaos patlaması gibi zincire çok ve karışık top ekle
if (typeof addBallToChain === "function" && typeof addBallGroup === "function") {
// 4-7 arası rastgele top ekle
var extraBalls = 4 + Math.floor(Math.random() * 4);
for (var i = 0; i < extraBalls; i++) {
if (Math.random() < 0.5) {
addBallToChain();
} else {
addBallGroup();
}
}
}
// Mor top yok edildiğinde purpleFrenzy başlat
if (typeof triggerPurpleFrenzy === "function") {
triggerPurpleFrenzy();
}
self.explode();
return true;
} else {
// Flash purple ball to show it was hit
tween(self.ballGraphics, {
tint: 0xFF00FF,
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self.ballGraphics, {
tint: 0xFFFFFF,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeIn
});
}
});
return false;
}
} else {
self.explode();
return true;
}
};
return self;
});
var Frog = Container.expand(function () {
var self = Container.call(this);
self.frogGraphics = self.attachAsset('frog', {
anchorX: 0.5,
anchorY: 0.5
});
self.currentBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
self.nextBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
self.currentBall = self.attachAsset('ball_' + self.currentBallColor, {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -40,
scaleX: 0.6,
scaleY: 0.6
});
// Removed highlight circle behind frog
self.aimAngle = 0;
self.canShoot = true;
self.updateFrogColor = function () {
// Color mapping for frog tinting based on ball color
var colorMap = {
'red': 0xff8888,
'blue': 0x8888ff,
'yellow': 0xffff88,
'green': 0x88ff88,
'purple': 0xff88ff
};
self.frogGraphics.tint = colorMap[self.currentBallColor] || 0xffffff;
};
// Initialize frog color
self.updateFrogColor();
self.updateAim = function (targetX, targetY) {
var dx = targetX - self.x;
var dy = targetY - self.y;
self.aimAngle = Math.atan2(dy, dx);
self.frogGraphics.rotation = self.aimAngle + Math.PI / 2;
};
self.shoot = function () {
if (!self.canShoot) return null;
var projectile = new Projectile(self.currentBallColor);
projectile.x = self.x;
projectile.y = self.y;
projectile.velocityX = Math.cos(self.aimAngle) * projectile.speed;
projectile.velocityY = Math.sin(self.aimAngle) * projectile.speed;
// Add visual effect when projectile is fired
// Create shooting effect with glow and scale animation
tween(projectile.projectileGraphics, {
scaleX: 1.2,
scaleY: 1.2,
tint: 0xFFFFFF
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(projectile.projectileGraphics, {
scaleX: 0.8,
scaleY: 0.8,
tint: 0xFFFFFF
}, {
duration: 100,
easing: tween.easeIn
});
}
});
// Create muzzle flash effect at frog's mouth
var muzzleFlash = LK.getAsset('ball_yellow', {
anchorX: 0.5,
anchorY: 0.5,
x: self.x + Math.cos(self.aimAngle) * 30,
y: self.y + Math.sin(self.aimAngle) * 30,
scaleX: 0.4,
scaleY: 0.4,
alpha: 0.8,
tint: 0xFFD700
});
game.addChild(muzzleFlash);
// Animate muzzle flash
tween(muzzleFlash, {
scaleX: 0.8,
scaleY: 0.8,
alpha: 0
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
if (muzzleFlash.parent) {
muzzleFlash.parent.removeChild(muzzleFlash);
}
}
});
// Update frog's current ball
self.currentBallColor = self.nextBallColor;
self.nextBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
if (self.currentBall.parent) {
self.currentBall.parent.removeChild(self.currentBall);
}
self.currentBall = self.attachAsset('ball_' + self.currentBallColor, {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -40,
scaleX: 0.6,
scaleY: 0.6
});
// Removed highlight circle and pulsing effect logic
// Update frog color to match new ball
self.updateFrogColor();
LK.getSound('shoot').play();
return projectile;
};
return self;
});
// Game constants
var Projectile = Container.expand(function (color) {
var self = Container.call(this);
self.ballColor = color;
self.projectileGraphics = self.attachAsset('ball_' + self.ballColor, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 12;
self.active = true;
self.update = function () {
if (!self.active) return;
self.x += self.velocityX;
self.y += self.velocityY;
// Check bounds
if (self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732) {
self.active = false;
if (self.parent) {
self.parent.removeChild(self);
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2d5016
});
/****
* Game Code
****/
// Game constants
// Initialize game assets with Maya theme and retro pixel style
var ballColors = ['red', 'blue', 'yellow', 'green', 'purple'];
var pathRadius = 400;
var centerX = 2048 / 2;
var centerY = 2732 / 2;
var chainSpeed = 0.22; // Slower chain movement for longer play
var maxChainLength = 220; // Allow even more balls in chain
var MAX_SPEED = 8; // Maximum allowed speed for balls
// Game variables
var ballChain = [];
var projectiles = [];
var gameRunning = true;
var chainProgress = 0;
var matchCombo = 0;
// Add green leafy background image (fills the screen, behind all game elements)
var leafyBg = LK.getAsset('path_marker', {
anchorX: 0.5,
anchorY: 0.5,
x: centerX,
y: centerY,
scaleX: 2048 / 3000,
scaleY: 2732 / 3000,
alpha: 0.7 // subtle, not too strong
});
game.addChild(leafyBg);
// Create temple center
var templeCenter = LK.getAsset('temple_center', {
anchorX: 0.5,
anchorY: 0.5,
x: centerX,
y: centerY
});
game.addChild(templeCenter);
// Create frog
var frog = new Frog();
frog.x = centerX;
frog.y = centerY;
game.addChild(frog);
// Create score display
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create chain length display
var chainTxt = new Text2('Chain: 0', {
size: 60,
fill: 0xFFFF00
});
chainTxt.anchor.set(0, 0);
chainTxt.x = 50;
chainTxt.y = 50;
LK.gui.topLeft.addChild(chainTxt);
// Initialize ball chain
function createInitialChain() {
for (var i = 0; i < 130; i++) {
// Increased from 90 to 130 for longer play
var color = ballColors[Math.floor(Math.random() * ballColors.length)];
var ball = new Ball(color);
ball.chainIndex = i;
ball.pathPosition = i * 70;
ballChain.push(ball);
game.addChild(ball);
updateBallPosition(ball);
}
}
// Update ball position along scattered path with orderly movement
function updateBallPosition(ball) {
if (!ball.scatterDirection) {
// Initialize scatter direction for each ball
var angleOffset = ball.chainIndex * 137.5 % 360; // Golden angle for even distribution
ball.scatterDirection = angleOffset * Math.PI / 180;
ball.scatterRadius = 200 + ball.chainIndex % 3 * 50; // Varying distances
}
var totalProgress = chainProgress + ball.pathPosition;
var moveDistance = totalProgress * 0.5;
var targetX = centerX + Math.cos(ball.scatterDirection) * (ball.scatterRadius + moveDistance);
var targetY = centerY + Math.sin(ball.scatterDirection) * (ball.scatterRadius + moveDistance);
// Smooth movement towards target position
ball.x = ball.x + (targetX - ball.x) * 0.1;
ball.y = ball.y + (targetY - ball.y) * 0.1;
}
// Add new ball to front of chain
function addBallToChain() {
if (ballChain.length >= maxChainLength) return;
var color = ballColors[Math.floor(Math.random() * ballColors.length)];
var ball = new Ball(color);
ball.chainIndex = ballChain.length;
ball.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
ballChain.push(ball);
game.addChild(ball);
updateBallPosition(ball);
}
// Add group of same color balls occasionally
function addBallGroup() {
if (ballChain.length >= maxChainLength - 5) return;
var groupColor = ballColors[Math.floor(Math.random() * ballColors.length)];
var groupSize = 3 + Math.floor(Math.random() * 3); // 3-5 balls
for (var i = 0; i < groupSize; i++) {
if (ballChain.length >= maxChainLength) break;
var ball = new Ball(groupColor);
ball.chainIndex = ballChain.length;
ball.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
ballChain.push(ball);
game.addChild(ball);
updateBallPosition(ball);
}
}
// Check for matches in chain
function checkMatches() {
var matches = [];
var currentColor = null;
var currentGroup = [];
for (var i = 0; i < ballChain.length; i++) {
var ball = ballChain[i];
if (ball.isExploding) continue;
if (ball.ballColor === currentColor) {
currentGroup.push(ball);
} else {
if (currentGroup.length >= 3) {
matches = matches.concat(currentGroup);
}
currentColor = ball.ballColor;
currentGroup = [ball];
}
}
// Check last group
if (currentGroup.length >= 3) {
matches = matches.concat(currentGroup);
}
if (matches.length > 0) {
// Award points
var points = matches.length * 10;
if (matchCombo > 0) {
points *= matchCombo + 1;
}
LK.setScore(LK.getScore() + points);
matchCombo++;
// Explode matched balls with Maya-themed effects
for (var j = 0; j < matches.length; j++) {
var matchedBall = matches[j];
// Create temple-themed glow effect
tween(matchedBall.ballGraphics, {
tint: 0xFFD700,
// Golden glow
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 150,
easing: tween.easeOut
});
// Add screen flash effect for larger matches
if (matches.length >= 5) {
LK.effects.flashScreen(0xFFD700, 400); // Golden flash
}
matchedBall.explode();
}
// Remove exploded balls from chain
ballChain = ballChain.filter(function (ball) {
return !ball.isExploding;
});
// Reindex remaining balls
for (var k = 0; k < ballChain.length; k++) {
ballChain[k].chainIndex = k;
}
// Create energy burst effect at match location
if (matches.length > 0) {
var centerMatchX = 0;
var centerMatchY = 0;
for (var effectIndex = 0; effectIndex < matches.length; effectIndex++) {
centerMatchX += matches[effectIndex].x;
centerMatchY += matches[effectIndex].y;
}
centerMatchX /= matches.length;
centerMatchY /= matches.length;
// Create energy orbs radiating from match center
for (var orbIndex = 0; orbIndex < 6; orbIndex++) {
var energyOrb = LK.getAsset('ball_yellow', {
anchorX: 0.5,
anchorY: 0.5,
x: centerMatchX,
y: centerMatchY,
scaleX: 0.3,
scaleY: 0.3,
alpha: 0.8
});
game.addChild(energyOrb);
var angle = orbIndex * 60 * Math.PI / 180;
var distance = 120 + Math.random() * 80;
tween(energyOrb, {
x: centerMatchX + Math.cos(angle) * distance,
y: centerMatchY + Math.sin(angle) * distance,
alpha: 0,
scaleX: 0.1,
scaleY: 0.1
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
if (energyOrb.parent) {
energyOrb.parent.removeChild(energyOrb);
}
}
});
}
}
LK.getSound('match').play();
// Add new balls after successful matches to increase difficulty
// Add more balls for larger matches to reward skillful play
var ballsToAdd = 3 + Math.floor(matches.length / 3); // Base 3 + bonus for larger matches
for (var addCount = 0; addCount < ballsToAdd; addCount++) {
addBallToChain();
}
// Check for chain reactions
LK.setTimeout(function () {
checkMatches();
}, 300);
} else {
matchCombo = 0;
}
}
// Insert projectile into chain
function insertProjectileIntoChain(projectile, insertIndex) {
var newBall = new Ball(projectile.ballColor);
newBall.chainIndex = insertIndex;
// Adjust positions of balls after insertion point
for (var i = insertIndex; i < ballChain.length; i++) {
ballChain[i].chainIndex++;
ballChain[i].pathPosition += 70;
}
// Set position for new ball
if (insertIndex < ballChain.length) {
newBall.pathPosition = ballChain[insertIndex].pathPosition - 70;
} else {
newBall.pathPosition = insertIndex * 70;
}
ballChain.splice(insertIndex, 0, newBall);
game.addChild(newBall);
updateBallPosition(newBall);
// Remove projectile
if (projectile.parent) {
projectile.parent.removeChild(projectile);
}
// Check for matches
LK.setTimeout(function () {
checkMatches();
}, 100);
}
function handleBallHit(projectileColor, targetBallColor) {
if (targetBallColor === "purple") {
// Mor topa vurulunca 20 puan ekle
LK.setScore(LK.getScore() + 20);
LK.getSound('explosion').play(); // sinek efekti
return;
}
if (projectileColor === targetBallColor) {
// Doğru renge vurulduysa
// Check if the hit ball is a big combo ball (2x size, 50 points)
if (typeof hitBall !== "undefined" && hitBall.isBigComboBall) {
LK.setScore(LK.getScore() + 50);
} else {
LK.setScore(LK.getScore() + 5);
}
LK.getSound('match').play();
} else {
// Yanlış renge vurulduysa
LK.setScore(Math.max(0, LK.getScore() - 5));
LK.getSound('shoot').play();
}
}
// Handle touch input
game.down = function (x, y, obj) {
if (!gameRunning) return;
frog.updateAim(x, y);
var projectile = frog.shoot();
if (projectile) {
projectiles.push(projectile);
game.addChild(projectile);
}
};
game.move = function (x, y, obj) {
if (!gameRunning) return;
frog.updateAim(x, y);
};
// Main game update loop
game.update = function () {
if (!gameRunning) return;
// Update chain progress
chainProgress += chainSpeed;
// Update ball positions
for (var i = 0; i < ballChain.length; i++) {
var ball = ballChain[i];
if (!ball.isExploding) {
ball.lastPathPosition = ball.pathPosition;
var lastX = ball.x;
var lastY = ball.y;
updateBallPosition(ball);
// Check off-screen status
ball.checkOffScreen();
// Detect very fast moving balls and occasionally destroy them
var deltaX = ball.x - lastX;
var deltaY = ball.y - lastY;
var speed = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
// Limit ball speed to MAX_SPEED
if (speed > MAX_SPEED) {
var speedRatio = MAX_SPEED / speed;
var limitedDeltaX = deltaX * speedRatio;
var limitedDeltaY = deltaY * speedRatio;
ball.x = lastX + limitedDeltaX;
ball.y = lastY + limitedDeltaY;
speed = MAX_SPEED;
}
if (speed > 8 && Math.random() < 0.02) {
// 2% chance to destroy fast balls
ball.explode();
ballChain.splice(i, 1);
i--; // Adjust index after removal
// Reindex remaining balls
for (var reindexI = 0; reindexI < ballChain.length; reindexI++) {
ballChain[reindexI].chainIndex = reindexI;
}
continue;
}
// Check if chain reached center (game over condition)
var totalProgress = chainProgress + ball.pathPosition;
var distanceFromCenter = Math.sqrt((ball.x - centerX) * (ball.x - centerX) + (ball.y - centerY) * (ball.y - centerY));
if (distanceFromCenter <= 120 && ball.chainIndex === 0) {
gameRunning = false;
LK.showGameOver();
return;
}
}
}
// Update projectiles
for (var j = projectiles.length - 1; j >= 0; j--) {
var projectile = projectiles[j];
if (!projectile.active) {
projectiles.splice(j, 1);
continue;
}
// Check collision with chain balls
var hitBall = null;
var insertIndex = -1;
for (var k = 0; k < ballChain.length; k++) {
var chainBall = ballChain[k];
if (chainBall.isExploding) continue;
var dx = projectile.x - chainBall.x;
var dy = projectile.y - chainBall.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 55) {
hitBall = chainBall;
insertIndex = k;
break;
}
}
if (hitBall) {
// Check if projectile color matches hit ball color for scoring
var isColorMatch = projectile.ballColor === hitBall.ballColor;
var isPurpleBall = hitBall.ballColor === 'purple';
// Destroy ball on hit (purple balls need multiple hits)
var ballDestroyed = hitBall.destroyOnHit();
if (ballDestroyed) {
// Remove destroyed ball from chain
for (var removeIndex = 0; removeIndex < ballChain.length; removeIndex++) {
if (ballChain[removeIndex] === hitBall) {
ballChain.splice(removeIndex, 1);
break;
}
}
// Reindex remaining balls
for (var reindexK = 0; reindexK < ballChain.length; reindexK++) {
ballChain[reindexK].chainIndex = reindexK;
}
// Use centralized scoring function
handleBallHit(projectile.ballColor, hitBall.ballColor);
}
// Only create special effects for matching colors (excluding purple)
if (isColorMatch && !isPurpleBall && hitBall && hitBall.ballGraphics) {
// Create Maya-themed matching effect
tween(hitBall.ballGraphics, {
tint: 0xFFD700,
// Golden glow
scaleX: 1.4,
scaleY: 1.4
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
if (hitBall && hitBall.ballGraphics) {
tween(hitBall.ballGraphics, {
tint: 0xFFFFFF,
// Return to normal
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeIn
});
}
}
});
// Create energy burst effect around the hit ball
for (var effectIndex = 0; effectIndex < 4; effectIndex++) {
var energyParticle = LK.getAsset('ball_yellow', {
anchorX: 0.5,
anchorY: 0.5,
x: hitBall.x,
y: hitBall.y,
scaleX: 0.2,
scaleY: 0.2,
alpha: 0.9
});
game.addChild(energyParticle);
var angle = effectIndex * 90 * Math.PI / 180;
var distance = 80;
tween(energyParticle, {
x: hitBall.x + Math.cos(angle) * distance,
y: hitBall.y + Math.sin(angle) * distance,
alpha: 0,
scaleX: 0.05,
scaleY: 0.05
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
if (energyParticle.parent) {
energyParticle.parent.removeChild(energyParticle);
}
}
});
}
// Only add bonus balls for correct color matches (not purple)
if (isColorMatch && !isPurpleBall) {
// Increase combo count for consecutive correct hits
if (typeof comboCount === "undefined") comboCount = 1;else comboCount++;
// Her doğru vuruştan sonra ortaya çıkan top sayısını artır (kombo stili)
var ballsToAdd = Math.min(5 + comboCount, 20); // Kombo ile artan, bolca top
for (var comboI = 0; comboI < ballsToAdd; comboI++) {
addBallToChain();
}
// Her doğru vuruşta toplar çok yavaş hareket etsin
chainSpeed = 0.05; // Çok yavaş hareket
// --- Combo: Track per-color hit counts for 2x big, 50-point ball after 3 hits of same color ---
if (typeof colorHitCounts === "undefined") colorHitCounts = {};
// Initialize color hit count if not present
if (!colorHitCounts[hitBall.ballColor]) {
colorHitCounts[hitBall.ballColor] = 0;
}
colorHitCounts[hitBall.ballColor]++;
// When 3 hits of the same color (at any time), spawn a 2x big random color ball
if (colorHitCounts[hitBall.ballColor] === 3) {
// Pick a random color for the big ball
var bigColors = ballColors.slice();
var randomBigColor = bigColors[Math.floor(Math.random() * bigColors.length)];
var bigBall = new Ball(randomBigColor);
bigBall.chainIndex = ballChain.length;
bigBall.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
// Büyük top için scale artır
bigBall.ballGraphics.scaleX = 2.0;
bigBall.ballGraphics.scaleY = 2.0;
// Mark as big and worth 50 points
bigBall.isBigComboBall = true;
ballChain.push(bigBall);
game.addChild(bigBall);
updateBallPosition(bigBall);
// 50 puan ekle
LK.setScore(LK.getScore() + 50);
// Reset this color's hit count
colorHitCounts[hitBall.ballColor] = 0;
}
} else {
// Reset combo on wrong color or purple
comboCount = 0;
// Reset unique color combo
colorComboHits = {};
colorComboOrder = [];
}
}
// Remove projectile immediately after hit
projectile.active = false;
if (projectile.parent) {
projectile.parent.removeChild(projectile);
}
projectiles.splice(j, 1);
if (!ballDestroyed) {
insertProjectileIntoChain(projectile, insertIndex);
}
}
}
// --- Continuous, looping ball and group spawns until score is zero ---
// Mor top yendikten sonra bir süre mor topların spawn oranını ve karmaşıklığını artır
if (typeof purpleFrenzyTicks === "undefined") {
var purpleFrenzyTicks = 0;
var purpleFrenzyEndTick = 0;
}
if (typeof lastPurpleFrenzyTriggerTick === "undefined") {
var lastPurpleFrenzyTriggerTick = -10000;
}
// Mor top yendikten sonra tetiklenecek fonksiyon
if (typeof triggerPurpleFrenzy === "undefined") {
var triggerPurpleFrenzy = function triggerPurpleFrenzy() {
purpleFrenzyTicks = 0;
purpleFrenzyEndTick = LK.ticks + 600 + Math.floor(Math.random() * 300); // 10-15 saniye
lastPurpleFrenzyTriggerTick = LK.ticks;
};
}
// Mor top yendikten sonra Ball.destroyOnHit içinde triggerPurpleFrenzy() çağrılır
if (LK.getScore() > 0) {
// Timers for next ball and group spawn
if (typeof nextBallSpawnTick === "undefined") {
var nextBallSpawnTick = LK.ticks + 30 + Math.floor(Math.random() * 90); // 0.5-2s
var nextBallGroupSpawnTick = LK.ticks + 120 + Math.floor(Math.random() * 180); // 2-5s
var nextChaosSpawnTick = LK.ticks + 180 + Math.floor(Math.random() * 300); // 3-8s
}
// Mor top fazlalığı aktif mi?
var purpleFrenzyActive = purpleFrenzyEndTick > LK.ticks;
// Random single ball spawns
if (LK.ticks >= nextBallSpawnTick && ballChain.length < maxChainLength) {
var ballsToAdd = purpleFrenzyActive ? 2 + Math.floor(Math.random() * 3) : 1 + Math.floor(Math.random() * 2); // 2-4 balls if frenzy, else 1-2
for (var i = 0; i < ballsToAdd; i++) {
// Frenzy sırasında %40 mor top, %60 random
if (purpleFrenzyActive && Math.random() < 0.4) {
var ball = new Ball('purple');
ball.chainIndex = ballChain.length;
ball.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
ballChain.push(ball);
game.addChild(ball);
updateBallPosition(ball);
} else {
addBallToChain();
}
}
// Next spawn in 0.3-1s if frenzy, else 0.5-2s
nextBallSpawnTick = LK.ticks + (purpleFrenzyActive ? 18 + Math.floor(Math.random() * 30) : 30 + Math.floor(Math.random() * 90));
}
// Random group spawns
if (LK.ticks >= nextBallGroupSpawnTick && ballChain.length < maxChainLength - 5) {
var doGroup = Math.random() < (purpleFrenzyActive ? 0.9 : 0.7); // 90% group if frenzy
if (doGroup) {
// Frenzy sırasında grup içinde mor toplar karışık
if (purpleFrenzyActive && Math.random() < 0.5) {
var groupSize = 3 + Math.floor(Math.random() * 3); // 3-5 balls
for (var gi = 0; gi < groupSize; gi++) {
var color = Math.random() < 0.5 ? 'purple' : ballColors[Math.floor(Math.random() * ballColors.length)];
var ball = new Ball(color);
ball.chainIndex = ballChain.length;
ball.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
ballChain.push(ball);
game.addChild(ball);
updateBallPosition(ball);
}
} else {
addBallGroup();
}
} else {
addBallToChain();
addBallToChain();
}
// Next group in 1-2.5s if frenzy, else 2-5s
nextBallGroupSpawnTick = LK.ticks + (purpleFrenzyActive ? 60 + Math.floor(Math.random() * 90) : 120 + Math.floor(Math.random() * 180));
}
// Rare chaos burst: lots of balls at once, unpredictable
if (LK.ticks >= nextChaosSpawnTick && ballChain.length < maxChainLength - 8) {
var chaosCount = purpleFrenzyActive ? 5 + Math.floor(Math.random() * 4) : 3 + Math.floor(Math.random() * 3); // 5-8 balls if frenzy, else 3-5
for (var i = 0; i < chaosCount; i++) {
if (purpleFrenzyActive && Math.random() < 0.5) {
var color = Math.random() < 0.7 ? 'purple' : ballColors[Math.floor(Math.random() * ballColors.length)];
var ball = new Ball(color);
ball.chainIndex = ballChain.length;
ball.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
ballChain.push(ball);
game.addChild(ball);
updateBallPosition(ball);
} else if (Math.random() < 0.5) {
addBallToChain();
} else {
addBallGroup();
}
}
// Next chaos in 2-4s if frenzy, else 3-8s
nextChaosSpawnTick = LK.ticks + (purpleFrenzyActive ? 120 + Math.floor(Math.random() * 120) : 180 + Math.floor(Math.random() * 300));
}
} else {
// If score is zero, stop all new ball spawns
// Optionally, you could clear timers or handle end-of-loop logic here
}
// Update UI
scoreTxt.setText('Score: ' + LK.getScore());
chainTxt.setText('Chain: ' + ballChain.length);
// Check if all balls are scattered off screen (game over condition)
var allBallsOffScreen = ballChain.length > 0;
for (var m = 0; m < ballChain.length; m++) {
if (!ballChain[m].isOffScreen && !ballChain[m].isExploding) {
allBallsOffScreen = false;
break;
}
}
if (allBallsOffScreen && ballChain.length > 0) {
gameRunning = false;
LK.showGameOver();
return;
}
// Win condition - clear all balls
if (ballChain.length === 0) {
gameRunning = false;
LK.setScore(LK.getScore() + 1000); // Bonus for clearing
LK.showYouWin();
return;
}
};
// Initialize the game
createInitialChain();
;
// Play background music 'amazon'
LK.playMusic('amazon');
// Minimalistic tween library for animations ===================================================================
--- original.js
+++ change.js
@@ -712,21 +712,21 @@
addBallToChain();
}
// Her doğru vuruşta toplar çok yavaş hareket etsin
chainSpeed = 0.05; // Çok yavaş hareket
- // --- Combo: Track unique color hits for 2x big, 50-point ball ---
- if (typeof colorComboHits === "undefined") colorComboHits = {};
- if (typeof colorComboOrder === "undefined") colorComboOrder = [];
- // Only count a color once per combo cycle
- if (!colorComboHits[hitBall.ballColor]) {
- colorComboHits[hitBall.ballColor] = true;
- colorComboOrder.push(hitBall.ballColor);
+ // --- Combo: Track per-color hit counts for 2x big, 50-point ball after 3 hits of same color ---
+ if (typeof colorHitCounts === "undefined") colorHitCounts = {};
+ // Initialize color hit count if not present
+ if (!colorHitCounts[hitBall.ballColor]) {
+ colorHitCounts[hitBall.ballColor] = 0;
}
- // When 5 unique colors have been hit (even if at different times), spawn a big ball
- if (colorComboOrder.length === 5) {
- // Pick the last color hit for the big ball
- var bigColor = colorComboOrder[colorComboOrder.length - 1];
- var bigBall = new Ball(bigColor);
+ colorHitCounts[hitBall.ballColor]++;
+ // When 3 hits of the same color (at any time), spawn a 2x big random color ball
+ if (colorHitCounts[hitBall.ballColor] === 3) {
+ // Pick a random color for the big ball
+ var bigColors = ballColors.slice();
+ var randomBigColor = bigColors[Math.floor(Math.random() * bigColors.length)];
+ var bigBall = new Ball(randomBigColor);
bigBall.chainIndex = ballChain.length;
bigBall.pathPosition = ballChain.length > 0 ? ballChain[ballChain.length - 1].pathPosition + 70 : 0;
// Büyük top için scale artır
bigBall.ballGraphics.scaleX = 2.0;
@@ -737,11 +737,10 @@
game.addChild(bigBall);
updateBallPosition(bigBall);
// 50 puan ekle
LK.setScore(LK.getScore() + 50);
- // Reset combo tracking
- colorComboHits = {};
- colorComboOrder = [];
+ // Reset this color's hit count
+ colorHitCounts[hitBall.ballColor] = 0;
}
} else {
// Reset combo on wrong color or purple
comboCount = 0;
kocaman gözleri olan ve ağzında olan her renge göre renk değiştiren bir bukalemun. In-Game asset. 2d. High contrast. No shadows
minik ve çok sevimli bir yusufçuk. In-Game asset. 2d. High contrast. No shadows
minik sevimli bir tırtıl. In-Game asset. 2d. High contrast. No shadows
çirkin ve sevimsiz kara sinek mor renkli bir kısmı. In-Game asset. 2d. High contrast. No shadows
çok güzel renkleri olan ağırlıklı olarak kırmızı renkli kelebek. In-Game asset. 2d. High contrast. No shadows
yeşil yapraklar ve ağaçlar olan orta bir alan. In-Game asset. 2d. High contrast. No shadows
oval kütük küçük bir meydan gibi üstten görünümlü. In-Game asset. 2d. High contrast. No shadows
çember şeklinde bir görseli çerçeve içine alan çevresi yeşillik çerçeve. In-Game asset. 2d. High contrast. No shadows