User prompt
geri al
User prompt
birazcık sinek sayısı artsın
User prompt
büyük sinek 1 saniye sonra 1 can götürsün
User prompt
skor her 5 artıkça büyüksinek gelsin
User prompt
geri al
User prompt
büyük sinek hemen ölmesin 3 kere vurduğumuzda ölsün
User prompt
orta
User prompt
biraz sağ
User prompt
can biraz sola gitsin
User prompt
can skorum altında olsun
User prompt
can hemen gitmesin üstümüze yapışşın eğer 1 saniyede büyük sineğe vuramazsak canımız gitisn
User prompt
can hemen gitmesin üstümüze yapışşın eğer 2 saniyede büyük sineğe vuramazsak canımız gitisn
User prompt
can hemen gitmesin
User prompt
o bize yaklaştığı zaman 2 saniye sonra bir can gitsin
User prompt
canımız olsun 3 kere bize vurduğunda ölek
User prompt
40 olan şeyi 10000000000000000000000000000000000000000000000000000000 yap
User prompt
ve bu büyük sinek bize saldırsın
User prompt
skor her 10 artığında büyük sinek gelsin
User prompt
geri al
User prompt
her 10 tane kaladığımızda
User prompt
skoru 10 yapınca büyük sinek gelsin
User prompt
15 olan seyi kardır
User prompt
yakalama sayısını sil ve skor ekle
User prompt
kaçan sayısını sil
User prompt
kaçan sayısı 10 olsun
/**** * Classes ****/ //var tween = LK.import("@upit/tween.v1"); // Mosquito class: represents a single mosquito var Mosquito = Container.expand(function () { var self = Container.call(this); // Attach mosquito asset (ellipse, small, dark color) var mosquitoGfx = self.attachAsset('mosquito', { anchorX: 0.5, anchorY: 0.5 }); // Mosquito speed (pixels per tick) self.speed = 6 + Math.random() * 4; // 6-10 px/tick // Direction in radians (random) self.direction = Math.random() * Math.PI * 2; // Time until next direction change self.changeDirTimer = 30 + Math.floor(Math.random() * 60); // Mark as alive self.alive = true; // Update method: called every tick self.update = function () { // Move mosquito self.x += Math.cos(self.direction) * self.speed; self.y += Math.sin(self.direction) * self.speed; // Bounce off walls (game area: 0,0 to 2048,2732) var margin = mosquitoGfx.width / 2 + 10; if (self.x < margin) { self.x = margin; self.direction = Math.PI - self.direction + (Math.random() - 0.5) * 0.5; } if (self.x > 2048 - margin) { self.x = 2048 - margin; self.direction = Math.PI - self.direction + (Math.random() - 0.5) * 0.5; } if (self.y < margin + 100) { // leave top 100px for menu self.y = margin + 100; self.direction = -self.direction + (Math.random() - 0.5) * 0.5; } if (self.y > 2732 - margin) { self.y = 2732 - margin; self.direction = -self.direction + (Math.random() - 0.5) * 0.5; } // Change direction randomly self.changeDirTimer--; if (self.changeDirTimer <= 0) { self.direction += (Math.random() - 0.5) * Math.PI / 1.5; self.changeDirTimer = 30 + Math.floor(Math.random() * 60); } }; // When hit, play animation and destroy self.squash = function (_onFinish) { self.alive = false; // Instantly squash and fade out (no tween) self.scaleX = 1.7; self.scaleY = 0.5; self.alpha = 0; if (_onFinish) { _onFinish(); } }; return self; }); // Racket class: represents the player's racket var Racket = Container.expand(function () { var self = Container.call(this); // Attach racket asset (rectangle, bright color) var racketGfx = self.attachAsset('racket', { anchorX: 0.5, anchorY: 0.5 }); // Optionally, add a little shadow for visibility racketGfx.alpha = 0.95; // Racket size for collision self.radius = racketGfx.width * 0.5; // For touch feedback self.flash = function () { // Instantly flash racket (no tween) racketGfx.tint = 0xffff00; LK.setTimeout(function () { racketGfx.tint = 0xffffff; }, 80); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x888888 // Gray background }); /**** * Game Code ****/ // --- Asset Initialization --- // --- Game Variables --- // Tween plugin for smooth animations var mosquitoes = []; var racket = null; var score = 0; var scoreTxt = null; // Timer removed: no time limit var maxMosquitoes = 5; // Removed mosquitoesEscaped and maxEscaped (kaçan sayısı) as requested var gameActive = true; var dragNode = null; // --- UI Elements --- // Score text scoreTxt = new Text2('0', { size: 120, fill: "#222" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Timer text removed: no timer in UI // Missed mosquitoes text // Removed missedTxt UI element for kaçan sayısı // --- Helper Functions --- function spawnMosquito() { if (!gameActive) { return; } var m = new Mosquito(); // Random position, not too close to top (menu) var margin = 80; m.x = margin + Math.random() * (2048 - 2 * margin); m.y = 150 + Math.random() * (2732 - 250); mosquitoes.push(m); game.addChild(m); } function updateScore() { scoreTxt.setText(score); } // updateTimer removed: no timer to update // Removed updateMissed function (kaçan sayısı) function endGame(win) { gameActive = false; // Show win or game over if (win) { LK.showYouWin(); } else { LK.showGameOver(); } } // --- Racket Setup --- racket = new Racket(); game.addChild(racket); // Start racket in center, lower half racket.x = 2048 / 2; racket.y = 2732 * 0.7; // --- Touch/Drag Controls --- game.down = function (x, y, obj) { // Don't allow drag in top left 100x100 if (x < 100 && y < 100) { return; } dragNode = racket; // Move racket instantly to touch racket.x = x; racket.y = y; }; game.move = function (x, y, obj) { if (!gameActive) { return; } if (dragNode) { // Clamp racket inside game area (leave top 100px) var rw = racket.width * 0.5; var rh = racket.height * 0.5; var nx = Math.max(rw, Math.min(2048 - rw, x)); var ny = Math.max(100 + rh, Math.min(2732 - rh, y)); racket.x = nx; racket.y = ny; } }; game.up = function (x, y, obj) { dragNode = null; }; // --- Main Game Loop --- game.update = function () { if (!gameActive) { return; } // Update mosquitoes for (var i = mosquitoes.length - 1; i >= 0; i--) { var m = mosquitoes[i]; if (!m.alive) { continue; } m.update(); // Check collision with racket var dx = m.x - racket.x; var dy = m.y - racket.y; var dist = Math.sqrt(dx * dx + dy * dy); var hitRadius = m.width * 0.5 + racket.width * 0.5 * 0.7; if (dist < hitRadius) { // Hit! m.squash(function () { m.destroy(); }); mosquitoes.splice(i, 1); score += 1; updateScore(); racket.flash(); // Win condition if (score >= 15) { endGame(true); return; } continue; } // If mosquito is at edge for too long, count as escaped var margin = m.width / 2 + 10; if (m.x <= margin + 2 || m.x >= 2048 - margin - 2 || m.y <= margin + 102 || m.y >= 2732 - margin - 2) { // Escaped! m.alive = false; // Instantly fade out and destroy mosquito (no tween) m.alpha = 0; m.destroy(); mosquitoes.splice(i, 1); // Removed kaçan sayısı (escaped) logic and lose condition } } // Spawn new mosquitoes if needed if (mosquitoes.length < maxMosquitoes && gameActive) { if (Math.random() < 0.04) { // ~1 every 25 frames spawnMosquito(); } } }; // Timer removed: no time-based lose condition // --- Game Start --- score = 0; // Removed mosquitoesEscaped = 0 and updateMissed() (kaçan sayısı) at game start updateScore(); // No timer to update or start for (var i = 0; i < maxMosquitoes; i++) { spawnMosquito(); }
===================================================================
--- original.js
+++ change.js
@@ -103,10 +103,9 @@
var score = 0;
var scoreTxt = null;
// Timer removed: no time limit
var maxMosquitoes = 5;
-var mosquitoesEscaped = 0;
-var maxEscaped = 10;
+// Removed mosquitoesEscaped and maxEscaped (kaçan sayısı) as requested
var gameActive = true;
var dragNode = null;
// --- UI Elements ---
// Score text
@@ -117,14 +116,9 @@
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Timer text removed: no timer in UI
// Missed mosquitoes text
-var missedTxt = new Text2('', {
- size: 80,
- fill: "#b00"
-});
-missedTxt.anchor.set(1, 0);
-LK.gui.topRight.addChild(missedTxt);
+// Removed missedTxt UI element for kaçan sayısı
// --- Helper Functions ---
function spawnMosquito() {
if (!gameActive) {
return;
@@ -140,15 +134,9 @@
function updateScore() {
scoreTxt.setText(score);
}
// updateTimer removed: no timer to update
-function updateMissed() {
- if (mosquitoesEscaped > 0) {
- missedTxt.setText('Kaçan: ' + mosquitoesEscaped + '/' + maxEscaped);
- } else {
- missedTxt.setText('');
- }
-}
+// Removed updateMissed function (kaçan sayısı)
function endGame(win) {
gameActive = false;
// Show win or game over
if (win) {
@@ -232,15 +220,9 @@
// Instantly fade out and destroy mosquito (no tween)
m.alpha = 0;
m.destroy();
mosquitoes.splice(i, 1);
- mosquitoesEscaped += 1;
- updateMissed();
- // Lose condition
- if (mosquitoesEscaped >= maxEscaped) {
- endGame(false);
- return;
- }
+ // Removed kaçan sayısı (escaped) logic and lose condition
}
}
// Spawn new mosquitoes if needed
if (mosquitoes.length < maxMosquitoes && gameActive) {
@@ -252,11 +234,10 @@
};
// Timer removed: no time-based lose condition
// --- Game Start ---
score = 0;
-mosquitoesEscaped = 0;
+// Removed mosquitoesEscaped = 0 and updateMissed() (kaçan sayısı) at game start
updateScore();
-updateMissed();
// No timer to update or start
for (var i = 0; i < maxMosquitoes; i++) {
spawnMosquito();
}
\ No newline at end of file
sivrisinek. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
racket sivriseinek için . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
arı. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat