User prompt
şu yalancı kediyide ayrı model yap
User prompt
muzlar daha az hızla insin ve oyuncak kediler 40 puandan sonra çıkmaya başlasın
User prompt
oyuncak kediyi kaçırınca kaçırma puanı yükselmesin
User prompt
muz yiyince kediler 5 saniyeleğine yüzde 25 yavaşlasın ve muz daha nadir çıksın her 5 puanda yüzde 5 şansla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
muz olsun muzu yiyince 5 saniyeliğine yüzde 5 hızlanalım ve kediler daha yavaş iner 5 saniyeleğine ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
oyuncak kedi farklı model olsun nomrla kedi nin üsttüne yapma
User prompt
bide oyuncak kedi ekle tipi oyuncak kedi olsun ve onu yersek 2 saniye hareket edemiyoz ve etrafımızda dönüyoz 2 saniye sonra yine normal duruyoz
User prompt
buda çok nadir oldu her 10 puanda yüzde 10 ihtimalle çıksın
User prompt
ama direk üste değil ya çok sol yada çok sağ gitsin ve en üstegitsin en üstün 4 tık altı
User prompt
çok aşağıda yine baya üste çıksın ama çokta değil ve dahada nadir çıksın
User prompt
ama aşaığı ışınlanmasın biraz daha üste çıksın direk kaçanlara girmesin daha üste ışınlansın köpekten 2-3 kedi yukarı ve ya çok sağ yada çok sol gitsin
User prompt
kandırıkçı kedi olsun arada nadiren gelsin gelince bir yere giderken tam köpeğe çarcağında başka bir yere rstgele ışınlansın
User prompt
yada 0.2 değişsin
User prompt
hayır her kaçan kedide 0.5 düşme hızları artcağına 0.0.1 artsın
User prompt
hayır her kaçan kedide 1.5 düşme hızları artcağına 0.5 artsın
User prompt
0.5 hızlansın yada
User prompt
29 tane kaçarsa kaybedek ve her kamada 1.5 hızlansın
User prompt
1 milyona ulaşınca kazanalım ve her 25 puanda 0.1 hızlansın muz yiyen kediler
User prompt
YADA HER 5 PUANDA 0.0.1 BÜYÜSÜN
User prompt
HER 5 SKORDA BİR KÖPEK Bİ TIK DAHA BÜYÜSÜN 0.1 KADAR
User prompt
VE 100DE KAZANILSIN 10 KERE KAÇIRIRSAK KAYBEDEK
User prompt
HER 20 YEMEKTE BİR MUZ YİYEN KEDİLER KÜÇÜLSÜN KÖPEK YAVAŞLASIN
Code edit (1 edits merged)
Please save this source code
User prompt
Muzlu Kedi Avı
Initial prompt
muz yiyen kediler yukarıdan düşsün köpekler de onu yesin yakalayıp
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Banana: Special item that speeds up dog and slows cats for 5 seconds when caught var Banana = Container.expand(function () { var self = Container.call(this); // Attach banana asset (ellipse, yellow, to represent a banana) var bananaAsset = self.attachAsset('banana', { anchorX: 0.5, anchorY: 0.5 }); // Random scale for variety bananaAsset.scaleX = 1 + (Math.random() * 0.2 - 0.1); bananaAsset.scaleY = 1 + (Math.random() * 0.2 - 0.1); // Falling speed (slower than normal cats) self.speedY = 5 + Math.random() * 3; self.lastY = undefined; self.lastIntersecting = false; self.update = function () { var speedMult = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1; self.y += self.speedY * speedMult; }; return self; }); // Cat class: falling from the top, to be caught by the dog var Cat = Container.expand(function () { var self = Container.call(this); // Attach cat asset (ellipse, yellow, to represent a banana-eating cat) var catAsset = self.attachAsset('cat', { anchorX: 0.5, anchorY: 0.5 }); // Set random horizontal scale for variety catAsset.scaleX = 1 + (Math.random() * 0.3 - 0.15); catAsset.scaleY = 1 + (Math.random() * 0.3 - 0.15); // Falling speed (randomized for each cat) self.speedY = 10 + Math.random() * 6; // Track lastY for off-screen detection self.lastY = undefined; // Track lastIntersecting for collision detection self.lastIntersecting = false; // Update method called every tick self.update = function () { // Use speed multiplier if set (for shrinking effect) if (typeof Cat.prototype._speedMultiplier === "number") { self.y += self.speedY * Cat.prototype._speedMultiplier; } else { self.y += self.speedY; } }; return self; }); // Dog class: player-controlled, moves horizontally at the bottom var Dog = Container.expand(function () { var self = Container.call(this); // Attach dog asset (box, brown) var dogAsset = self.attachAsset('dog', { anchorX: 0.5, anchorY: 0.5 }); // Optionally, make the dog a bit wider dogAsset.scaleX = 1.3; dogAsset.scaleY = 1; // No update needed; position is set by player input return self; }); // ToyCat: Special cat that disables dog movement and spins dog for 2 seconds when caught var ToyCat = Container.expand(function () { var self = Container.call(this); // Attach toycat asset (unique image, not a tinted normal cat) var toyCatAsset = self.attachAsset('toycat', { anchorX: 0.5, anchorY: 0.5 }); // Random scale for variety toyCatAsset.scaleX = 1 + (Math.random() * 0.3 - 0.15); toyCatAsset.scaleY = 1 + (Math.random() * 0.3 - 0.15); // Falling speed (same as normal cats) self.speedY = 10 + Math.random() * 6; self.lastY = undefined; self.lastIntersecting = false; self.update = function () { var speedMult = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1; self.y += self.speedY * speedMult; }; return self; }); // TricksterCat: Rare cat that teleports when about to hit the dog var TricksterCat = Container.expand(function () { var self = Container.call(this); // Attach unique trickstercat asset (yalancı kedi) var tricksterCatAsset = self.attachAsset('trickstercat', { anchorX: 0.5, anchorY: 0.5 }); // Random scale for variety tricksterCatAsset.scaleX = 1 + (Math.random() * 0.3 - 0.15); tricksterCatAsset.scaleY = 1 + (Math.random() * 0.3 - 0.15); // Falling speed (same as normal cats) self.speedY = 10 + Math.random() * 6; self.lastY = undefined; self.lastIntersecting = false; self.hasTeleported = false; // Only teleport once per fall self.update = function () { // Use speed multiplier if set var speedMult = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1; self.y += self.speedY * speedMult; // Teleport logic: If about to hit the dog, teleport to a new random X, Y (only once) if (!self.hasTeleported && dog && Math.abs(self.y - dog.y) < 120 && Math.abs(self.x - dog.x) < (dog.width ? dog.width / 2 : 150)) { // Teleport logic: If about to hit the dog, teleport to a new random X (far left or far right) and to near the top (4 cat heights below top) var margin = 80; var newX; // 50% chance to go far left, 50% to far right if (Math.random() < 0.5) { newX = margin + Math.random() * 200; // Far left } else { newX = 2048 - margin - Math.random() * 200; // Far right } // Teleport to a Y that is 4 cat heights below the top var catHeight = self.height || 120; var newY = catHeight * 4; // Clamp to not go off the top if (newY < 100) newY = 100; self.x = newX; self.y = newY; self.hasTeleported = true; // Optional: flash effect to show teleport LK.effects.flashObject(self, 0x8e44ad, 200); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xf7e9b0 // Light yellow, banana-like background }); /**** * Game Code ****/ // --- Game Variables --- // Dog: brown box // Tween plugin for animations (optional, but included for future use) // --- Asset Initialization (shapes) --- // Cat: yellow ellipse var cats = []; // Array of falling cats var bananas = []; // Array of falling bananas var missedCats = 0; // Number of missed cats var score = 0; // Player score var winScore = 1000000; // Score needed to win var maxMissed = 29; // Max missed cats before game over // Banana effect state var bananaEffectActive = false; var bananaEffectTimeout = null; // --- UI Elements --- var scoreTxt = new Text2('0', { size: 120, fill: 0x222222 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var missedTxt = new Text2('Kaçan: 0', { size: 70, fill: 0xB22222 }); missedTxt.anchor.set(1, 0); LK.gui.topRight.addChild(missedTxt); // --- Dog (Player) Initialization --- var dog = new Dog(); game.addChild(dog); // Place dog at bottom center dog.x = 2048 / 2; dog.y = 2732 - 120; // --- Touch/Drag Controls --- var dragDog = false; function clamp(val, min, max) { return Math.max(min, Math.min(max, val)); } function handleMove(x, y, obj) { if (dragDog) { // Clamp dog within screen horizontally var halfDog = dog.width ? dog.width / 2 : 110; var moveSpeedMultiplier = typeof Dog.prototype._moveSpeedMultiplier === "number" ? Dog.prototype._moveSpeedMultiplier : 1; var targetX = clamp(x, halfDog, 2048 - halfDog); if (moveSpeedMultiplier < 1) { // Only allow the dog to move a fraction of the distance per tick dog.x += (targetX - dog.x) * moveSpeedMultiplier; } else { dog.x = targetX; } } } game.move = handleMove; game.down = function (x, y, obj) { // Only start drag if touch is near the dog (bottom 1/3 of screen) if (y > 2732 - 350) { dragDog = true; handleMove(x, y, obj); } }; game.up = function (x, y, obj) { dragDog = false; }; // --- Cat Spawning --- function spawnCat() { // TricksterCat: 10% chance to spawn, but only on multiples of 10 score var isTrickster = false; if (score > 0 && score % 10 === 0 && Math.random() < 0.10) { isTrickster = true; } var isToyCat = false; // ToyCat: 1 in 12 chance, but never with TricksterCat, and only after score >= 40 if (!isTrickster && score >= 40 && Math.floor(Math.random() * 12) === 0) { isToyCat = true; } var cat; if (isTrickster) { cat = new TricksterCat(); } else if (isToyCat) { cat = new ToyCat(); } else { cat = new Cat(); } // Random X position, avoid edges var margin = 80; var catWidth = 120; cat.x = margin + Math.random() * (2048 - 2 * margin); cat.y = -catWidth; cat.lastY = cat.y; cat.lastIntersecting = false; cats.push(cat); game.addChild(cat); // Banana: every 5 points, 5% chance, never with TricksterCat or ToyCat if (!isTrickster && !isToyCat && score > 0 && score % 5 === 0 && Math.random() < 0.05) { var banana = new Banana(); banana.x = margin + Math.random() * (2048 - 2 * margin); banana.y = -60; banana.lastY = banana.y; banana.lastIntersecting = false; bananas.push(banana); game.addChild(banana); } } // --- Game Update Loop --- game.update = function () { // Spawn new cat every 30 ticks (~0.5s) if (LK.ticks % 30 === 0) { spawnCat(); } // Update bananas for (var bi = bananas.length - 1; bi >= 0; bi--) { var banana = bananas[bi]; banana.update(); // Off-screen detection if (banana.lastY < 2732 + 60 && banana.y >= 2732 + 60) { banana.destroy(); bananas.splice(bi, 1); continue; } // Collision detection (catch) var bananaIntersecting = banana.intersects(dog); if (!banana.lastIntersecting && bananaIntersecting) { // Activate banana effect: dog speeds up, cats slow down for 5s if (!bananaEffectActive) { bananaEffectActive = true; // Save old multipliers var oldCatSpeed = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1; var oldDogMove = typeof Dog.prototype._moveSpeedMultiplier === "number" ? Dog.prototype._moveSpeedMultiplier : 1; // Apply effect: dog 5% faster, cats 25% slower Cat.prototype._speedMultiplier = oldCatSpeed * 0.75; Dog.prototype._moveSpeedMultiplier = oldDogMove * 1.05; // Visual effect LK.effects.flashObject(dog, 0xffe066, 600); // Remove after 5 seconds if (bananaEffectTimeout) { LK.clearTimeout(bananaEffectTimeout); } bananaEffectTimeout = LK.setTimeout(function () { // Restore to previous values (if not changed by other effects) Cat.prototype._speedMultiplier = oldCatSpeed; Dog.prototype._moveSpeedMultiplier = oldDogMove; bananaEffectActive = false; bananaEffectTimeout = null; }, 5000); } // Remove banana banana.destroy(); bananas.splice(bi, 1); continue; } banana.lastY = banana.y; banana.lastIntersecting = bananaIntersecting; } // Update cats for (var i = cats.length - 1; i >= 0; i--) { var cat = cats[i]; // Update position cat.update(); // Off-screen detection (missed) if (cat.lastY < 2732 + 60 && cat.y >= 2732 + 60) { // Cat missed // Do not increase missedCats if it's a ToyCat if (!(typeof ToyCat !== "undefined" && cat instanceof ToyCat)) { missedCats += 1; missedTxt.setText('Kaçan: ' + missedCats); // Every miss: speed up cat falling speed by 0.2 (additive, not multiplicative) Cat.prototype._speedMultiplier = (Cat.prototype._speedMultiplier || 1) + 0.2; // Game over if too many missed if (missedCats >= maxMissed) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); cat.destroy(); cats.splice(i, 1); return; } } LK.effects.flashObject(cat, 0xff0000, 400); cat.destroy(); cats.splice(i, 1); continue; } // Collision detection (catch) var intersecting = cat.intersects(dog); if (!cat.lastIntersecting && intersecting) { // If it's a TricksterCat and hasn't teleported, teleport instead of catching if (typeof TricksterCat !== "undefined" && cat instanceof TricksterCat && !cat.hasTeleported) { // Teleport logic is handled in TricksterCat.update, but force teleport if not done if (!cat.hasTeleported) { var margin = 80; var newX; // 50% chance to go far left, 50% to far right if (Math.random() < 0.5) { newX = margin + Math.random() * 200; // Far left } else { newX = 2048 - margin - Math.random() * 200; // Far right } // Teleport to a Y that is 4 cat heights below the top var catHeight = cat.height || 120; var newY = catHeight * 4; if (newY < 100) newY = 100; cat.x = newX; cat.y = newY; cat.hasTeleported = true; LK.effects.flashObject(cat, 0x8e44ad, 200); } // Don't catch, let it fall again continue; } // ToyCat: If caught, disable dog movement and spin for 2 seconds if (typeof ToyCat !== "undefined" && cat instanceof ToyCat) { // Disable dog movement Dog.prototype._moveSpeedMultiplier = 0; // Spin dog for 2 seconds (120 ticks) var spinTicks = 120; var originalRotation = dog.children && dog.children[0] ? dog.children[0].rotation : 0; if (dog.children && dog.children[0]) { dog.children[0].rotation = 0; } // Store spin state globally to avoid multiple spins at once if (!game._toyCatSpin) { game._toyCatSpin = { ticks: 0 }; var spinInterval = LK.setInterval(function () { if (dog.children && dog.children[0]) { // 2 full spins in 2 seconds dog.children[0].rotation = game._toyCatSpin.ticks / spinTicks * Math.PI * 4; } game._toyCatSpin.ticks++; if (game._toyCatSpin.ticks >= spinTicks) { // Restore dog movement and rotation Dog.prototype._moveSpeedMultiplier = 1; if (dog.children && dog.children[0]) { dog.children[0].rotation = originalRotation || 0; } LK.clearInterval(game._toyCatSpin.interval); game._toyCatSpin = null; } }, 1000 / 60); // 60 FPS game._toyCatSpin.interval = spinInterval; } LK.effects.flashObject(dog, 0x3498db, 400); } else { // Caught! score += 1; scoreTxt.setText(score); LK.effects.flashObject(dog, 0x00ff00, 300); // Every 5th score: grow the dog by 0.01x if (score % 5 === 0) { if (dog.children && dog.children.length > 0) { dog.children[0].scaleX += 0.01; dog.children[0].scaleY += 0.01; } } } // Every 20th catch: shrink all cats and slow down the dog if (score % 20 === 0) { // Shrink all existing cats for (var ci = 0; ci < cats.length; ci++) { var c = cats[ci]; if (c.children && c.children.length > 0) { c.children[0].scaleX *= 0.7; c.children[0].scaleY *= 0.7; } } // Slow down future cats Cat.prototype._speedMultiplier = (Cat.prototype._speedMultiplier || 1) * 0.9; // Slow down dog movement (by reducing max move per tick) Dog.prototype._moveSpeedMultiplier = (Dog.prototype._moveSpeedMultiplier || 1) * 0.9; } // Every 25th score: speed up cat falling speed by 0.1x if (score % 25 === 0 && score > 0) { Cat.prototype._speedMultiplier = (Cat.prototype._speedMultiplier || 1) * 1.1; } // Remove the caught cat cat.destroy(); cats.splice(i, 1); // Win condition if (score >= winScore) { LK.effects.flashScreen(0x00ff00, 1000); LK.showYouWin(); return; } continue; } // Update last states cat.lastY = cat.y; cat.lastIntersecting = intersecting; } }; // --- Initial UI State --- scoreTxt.setText(score); missedTxt.setText('Kaçan: ' + missedCats);
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Banana: Special item that speeds up dog and slows cats for 5 seconds when caught
var Banana = Container.expand(function () {
var self = Container.call(this);
// Attach banana asset (ellipse, yellow, to represent a banana)
var bananaAsset = self.attachAsset('banana', {
anchorX: 0.5,
anchorY: 0.5
});
// Random scale for variety
bananaAsset.scaleX = 1 + (Math.random() * 0.2 - 0.1);
bananaAsset.scaleY = 1 + (Math.random() * 0.2 - 0.1);
// Falling speed (slower than normal cats)
self.speedY = 5 + Math.random() * 3;
self.lastY = undefined;
self.lastIntersecting = false;
self.update = function () {
var speedMult = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1;
self.y += self.speedY * speedMult;
};
return self;
});
// Cat class: falling from the top, to be caught by the dog
var Cat = Container.expand(function () {
var self = Container.call(this);
// Attach cat asset (ellipse, yellow, to represent a banana-eating cat)
var catAsset = self.attachAsset('cat', {
anchorX: 0.5,
anchorY: 0.5
});
// Set random horizontal scale for variety
catAsset.scaleX = 1 + (Math.random() * 0.3 - 0.15);
catAsset.scaleY = 1 + (Math.random() * 0.3 - 0.15);
// Falling speed (randomized for each cat)
self.speedY = 10 + Math.random() * 6;
// Track lastY for off-screen detection
self.lastY = undefined;
// Track lastIntersecting for collision detection
self.lastIntersecting = false;
// Update method called every tick
self.update = function () {
// Use speed multiplier if set (for shrinking effect)
if (typeof Cat.prototype._speedMultiplier === "number") {
self.y += self.speedY * Cat.prototype._speedMultiplier;
} else {
self.y += self.speedY;
}
};
return self;
});
// Dog class: player-controlled, moves horizontally at the bottom
var Dog = Container.expand(function () {
var self = Container.call(this);
// Attach dog asset (box, brown)
var dogAsset = self.attachAsset('dog', {
anchorX: 0.5,
anchorY: 0.5
});
// Optionally, make the dog a bit wider
dogAsset.scaleX = 1.3;
dogAsset.scaleY = 1;
// No update needed; position is set by player input
return self;
});
// ToyCat: Special cat that disables dog movement and spins dog for 2 seconds when caught
var ToyCat = Container.expand(function () {
var self = Container.call(this);
// Attach toycat asset (unique image, not a tinted normal cat)
var toyCatAsset = self.attachAsset('toycat', {
anchorX: 0.5,
anchorY: 0.5
});
// Random scale for variety
toyCatAsset.scaleX = 1 + (Math.random() * 0.3 - 0.15);
toyCatAsset.scaleY = 1 + (Math.random() * 0.3 - 0.15);
// Falling speed (same as normal cats)
self.speedY = 10 + Math.random() * 6;
self.lastY = undefined;
self.lastIntersecting = false;
self.update = function () {
var speedMult = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1;
self.y += self.speedY * speedMult;
};
return self;
});
// TricksterCat: Rare cat that teleports when about to hit the dog
var TricksterCat = Container.expand(function () {
var self = Container.call(this);
// Attach unique trickstercat asset (yalancı kedi)
var tricksterCatAsset = self.attachAsset('trickstercat', {
anchorX: 0.5,
anchorY: 0.5
});
// Random scale for variety
tricksterCatAsset.scaleX = 1 + (Math.random() * 0.3 - 0.15);
tricksterCatAsset.scaleY = 1 + (Math.random() * 0.3 - 0.15);
// Falling speed (same as normal cats)
self.speedY = 10 + Math.random() * 6;
self.lastY = undefined;
self.lastIntersecting = false;
self.hasTeleported = false; // Only teleport once per fall
self.update = function () {
// Use speed multiplier if set
var speedMult = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1;
self.y += self.speedY * speedMult;
// Teleport logic: If about to hit the dog, teleport to a new random X, Y (only once)
if (!self.hasTeleported && dog && Math.abs(self.y - dog.y) < 120 && Math.abs(self.x - dog.x) < (dog.width ? dog.width / 2 : 150)) {
// Teleport logic: If about to hit the dog, teleport to a new random X (far left or far right) and to near the top (4 cat heights below top)
var margin = 80;
var newX;
// 50% chance to go far left, 50% to far right
if (Math.random() < 0.5) {
newX = margin + Math.random() * 200; // Far left
} else {
newX = 2048 - margin - Math.random() * 200; // Far right
}
// Teleport to a Y that is 4 cat heights below the top
var catHeight = self.height || 120;
var newY = catHeight * 4;
// Clamp to not go off the top
if (newY < 100) newY = 100;
self.x = newX;
self.y = newY;
self.hasTeleported = true;
// Optional: flash effect to show teleport
LK.effects.flashObject(self, 0x8e44ad, 200);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xf7e9b0 // Light yellow, banana-like background
});
/****
* Game Code
****/
// --- Game Variables ---
// Dog: brown box
// Tween plugin for animations (optional, but included for future use)
// --- Asset Initialization (shapes) ---
// Cat: yellow ellipse
var cats = []; // Array of falling cats
var bananas = []; // Array of falling bananas
var missedCats = 0; // Number of missed cats
var score = 0; // Player score
var winScore = 1000000; // Score needed to win
var maxMissed = 29; // Max missed cats before game over
// Banana effect state
var bananaEffectActive = false;
var bananaEffectTimeout = null;
// --- UI Elements ---
var scoreTxt = new Text2('0', {
size: 120,
fill: 0x222222
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var missedTxt = new Text2('Kaçan: 0', {
size: 70,
fill: 0xB22222
});
missedTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(missedTxt);
// --- Dog (Player) Initialization ---
var dog = new Dog();
game.addChild(dog);
// Place dog at bottom center
dog.x = 2048 / 2;
dog.y = 2732 - 120;
// --- Touch/Drag Controls ---
var dragDog = false;
function clamp(val, min, max) {
return Math.max(min, Math.min(max, val));
}
function handleMove(x, y, obj) {
if (dragDog) {
// Clamp dog within screen horizontally
var halfDog = dog.width ? dog.width / 2 : 110;
var moveSpeedMultiplier = typeof Dog.prototype._moveSpeedMultiplier === "number" ? Dog.prototype._moveSpeedMultiplier : 1;
var targetX = clamp(x, halfDog, 2048 - halfDog);
if (moveSpeedMultiplier < 1) {
// Only allow the dog to move a fraction of the distance per tick
dog.x += (targetX - dog.x) * moveSpeedMultiplier;
} else {
dog.x = targetX;
}
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Only start drag if touch is near the dog (bottom 1/3 of screen)
if (y > 2732 - 350) {
dragDog = true;
handleMove(x, y, obj);
}
};
game.up = function (x, y, obj) {
dragDog = false;
};
// --- Cat Spawning ---
function spawnCat() {
// TricksterCat: 10% chance to spawn, but only on multiples of 10 score
var isTrickster = false;
if (score > 0 && score % 10 === 0 && Math.random() < 0.10) {
isTrickster = true;
}
var isToyCat = false;
// ToyCat: 1 in 12 chance, but never with TricksterCat, and only after score >= 40
if (!isTrickster && score >= 40 && Math.floor(Math.random() * 12) === 0) {
isToyCat = true;
}
var cat;
if (isTrickster) {
cat = new TricksterCat();
} else if (isToyCat) {
cat = new ToyCat();
} else {
cat = new Cat();
}
// Random X position, avoid edges
var margin = 80;
var catWidth = 120;
cat.x = margin + Math.random() * (2048 - 2 * margin);
cat.y = -catWidth;
cat.lastY = cat.y;
cat.lastIntersecting = false;
cats.push(cat);
game.addChild(cat);
// Banana: every 5 points, 5% chance, never with TricksterCat or ToyCat
if (!isTrickster && !isToyCat && score > 0 && score % 5 === 0 && Math.random() < 0.05) {
var banana = new Banana();
banana.x = margin + Math.random() * (2048 - 2 * margin);
banana.y = -60;
banana.lastY = banana.y;
banana.lastIntersecting = false;
bananas.push(banana);
game.addChild(banana);
}
}
// --- Game Update Loop ---
game.update = function () {
// Spawn new cat every 30 ticks (~0.5s)
if (LK.ticks % 30 === 0) {
spawnCat();
}
// Update bananas
for (var bi = bananas.length - 1; bi >= 0; bi--) {
var banana = bananas[bi];
banana.update();
// Off-screen detection
if (banana.lastY < 2732 + 60 && banana.y >= 2732 + 60) {
banana.destroy();
bananas.splice(bi, 1);
continue;
}
// Collision detection (catch)
var bananaIntersecting = banana.intersects(dog);
if (!banana.lastIntersecting && bananaIntersecting) {
// Activate banana effect: dog speeds up, cats slow down for 5s
if (!bananaEffectActive) {
bananaEffectActive = true;
// Save old multipliers
var oldCatSpeed = typeof Cat.prototype._speedMultiplier === "number" ? Cat.prototype._speedMultiplier : 1;
var oldDogMove = typeof Dog.prototype._moveSpeedMultiplier === "number" ? Dog.prototype._moveSpeedMultiplier : 1;
// Apply effect: dog 5% faster, cats 25% slower
Cat.prototype._speedMultiplier = oldCatSpeed * 0.75;
Dog.prototype._moveSpeedMultiplier = oldDogMove * 1.05;
// Visual effect
LK.effects.flashObject(dog, 0xffe066, 600);
// Remove after 5 seconds
if (bananaEffectTimeout) {
LK.clearTimeout(bananaEffectTimeout);
}
bananaEffectTimeout = LK.setTimeout(function () {
// Restore to previous values (if not changed by other effects)
Cat.prototype._speedMultiplier = oldCatSpeed;
Dog.prototype._moveSpeedMultiplier = oldDogMove;
bananaEffectActive = false;
bananaEffectTimeout = null;
}, 5000);
}
// Remove banana
banana.destroy();
bananas.splice(bi, 1);
continue;
}
banana.lastY = banana.y;
banana.lastIntersecting = bananaIntersecting;
}
// Update cats
for (var i = cats.length - 1; i >= 0; i--) {
var cat = cats[i];
// Update position
cat.update();
// Off-screen detection (missed)
if (cat.lastY < 2732 + 60 && cat.y >= 2732 + 60) {
// Cat missed
// Do not increase missedCats if it's a ToyCat
if (!(typeof ToyCat !== "undefined" && cat instanceof ToyCat)) {
missedCats += 1;
missedTxt.setText('Kaçan: ' + missedCats);
// Every miss: speed up cat falling speed by 0.2 (additive, not multiplicative)
Cat.prototype._speedMultiplier = (Cat.prototype._speedMultiplier || 1) + 0.2;
// Game over if too many missed
if (missedCats >= maxMissed) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
cat.destroy();
cats.splice(i, 1);
return;
}
}
LK.effects.flashObject(cat, 0xff0000, 400);
cat.destroy();
cats.splice(i, 1);
continue;
}
// Collision detection (catch)
var intersecting = cat.intersects(dog);
if (!cat.lastIntersecting && intersecting) {
// If it's a TricksterCat and hasn't teleported, teleport instead of catching
if (typeof TricksterCat !== "undefined" && cat instanceof TricksterCat && !cat.hasTeleported) {
// Teleport logic is handled in TricksterCat.update, but force teleport if not done
if (!cat.hasTeleported) {
var margin = 80;
var newX;
// 50% chance to go far left, 50% to far right
if (Math.random() < 0.5) {
newX = margin + Math.random() * 200; // Far left
} else {
newX = 2048 - margin - Math.random() * 200; // Far right
}
// Teleport to a Y that is 4 cat heights below the top
var catHeight = cat.height || 120;
var newY = catHeight * 4;
if (newY < 100) newY = 100;
cat.x = newX;
cat.y = newY;
cat.hasTeleported = true;
LK.effects.flashObject(cat, 0x8e44ad, 200);
}
// Don't catch, let it fall again
continue;
}
// ToyCat: If caught, disable dog movement and spin for 2 seconds
if (typeof ToyCat !== "undefined" && cat instanceof ToyCat) {
// Disable dog movement
Dog.prototype._moveSpeedMultiplier = 0;
// Spin dog for 2 seconds (120 ticks)
var spinTicks = 120;
var originalRotation = dog.children && dog.children[0] ? dog.children[0].rotation : 0;
if (dog.children && dog.children[0]) {
dog.children[0].rotation = 0;
}
// Store spin state globally to avoid multiple spins at once
if (!game._toyCatSpin) {
game._toyCatSpin = {
ticks: 0
};
var spinInterval = LK.setInterval(function () {
if (dog.children && dog.children[0]) {
// 2 full spins in 2 seconds
dog.children[0].rotation = game._toyCatSpin.ticks / spinTicks * Math.PI * 4;
}
game._toyCatSpin.ticks++;
if (game._toyCatSpin.ticks >= spinTicks) {
// Restore dog movement and rotation
Dog.prototype._moveSpeedMultiplier = 1;
if (dog.children && dog.children[0]) {
dog.children[0].rotation = originalRotation || 0;
}
LK.clearInterval(game._toyCatSpin.interval);
game._toyCatSpin = null;
}
}, 1000 / 60); // 60 FPS
game._toyCatSpin.interval = spinInterval;
}
LK.effects.flashObject(dog, 0x3498db, 400);
} else {
// Caught!
score += 1;
scoreTxt.setText(score);
LK.effects.flashObject(dog, 0x00ff00, 300);
// Every 5th score: grow the dog by 0.01x
if (score % 5 === 0) {
if (dog.children && dog.children.length > 0) {
dog.children[0].scaleX += 0.01;
dog.children[0].scaleY += 0.01;
}
}
}
// Every 20th catch: shrink all cats and slow down the dog
if (score % 20 === 0) {
// Shrink all existing cats
for (var ci = 0; ci < cats.length; ci++) {
var c = cats[ci];
if (c.children && c.children.length > 0) {
c.children[0].scaleX *= 0.7;
c.children[0].scaleY *= 0.7;
}
}
// Slow down future cats
Cat.prototype._speedMultiplier = (Cat.prototype._speedMultiplier || 1) * 0.9;
// Slow down dog movement (by reducing max move per tick)
Dog.prototype._moveSpeedMultiplier = (Dog.prototype._moveSpeedMultiplier || 1) * 0.9;
}
// Every 25th score: speed up cat falling speed by 0.1x
if (score % 25 === 0 && score > 0) {
Cat.prototype._speedMultiplier = (Cat.prototype._speedMultiplier || 1) * 1.1;
}
// Remove the caught cat
cat.destroy();
cats.splice(i, 1);
// Win condition
if (score >= winScore) {
LK.effects.flashScreen(0x00ff00, 1000);
LK.showYouWin();
return;
}
continue;
}
// Update last states
cat.lastY = cat.y;
cat.lastIntersecting = intersecting;
}
};
// --- Initial UI State ---
scoreTxt.setText(score);
missedTxt.setText('Kaçan: ' + missedCats);
muz yiyen kedi. In-Game asset. 2d. High contrast. No shadows
KÖPEK AMA AÇ. In-Game asset. 2d. High contrast. No shadows
ipli fermuarı olan oyuncak kedi olduğu her yerden belli olan elinde muz olan bir kedi. In-Game asset. 2d. High contrast. No shadows
kedi yiyen aç muz. In-Game asset. 2d. High contrast. No shadows
casus kedi. In-Game asset. 2d. High contrast. No shadows