User prompt
kullanıcı adını giremiyorum?, etrafı yuvarlak hatlı dikdörtgen (orta boy) beyaz bir text kutusu (kullanıcı adı girmek için) oluştur
User prompt
oyun başlamadan ekranda kullanıcı adını girmek için kutucuk oluştur. oyuncu kaydolduktan sonra oyun direktifi yazısını gösterirsin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyun başlamadan önce kullanıcı adı sor, kullanıcı adı girilince oyun sonunda skor tablosu gösterilsin, skor tablosu her zaman en yüksek skoru yapan oyuncuları kaydetsin ve listelersin.
User prompt
havada tutmak yerine düşürmemek için yaz
User prompt
Sinek kelimesi yerine Yumurta yaz
User prompt
Please fix the bug: 'TypeError: LK.setGameOverMessage is not a function' in or related to this line: 'LK.setGameOverMessage("Seviye: " + currentLevel + "\nSkor: " + LK.getScore());' Line Number: 325
User prompt
oyun bitince hem seviyeyi hem de kazanılan puanı göster
User prompt
Please fix the bug: 'TypeError: LK.setGameOverMessage is not a function' in or related to this line: 'LK.setGameOverMessage("Skorun: " + LK.getScore());' Line Number: 325
User prompt
Please fix the bug: 'TypeError: LK.setGameOverText is not a function' in or related to this line: 'LK.setGameOverText("Skorun: " + LK.getScore());' Line Number: 325
User prompt
oyun bittiğinde ekrana kullanıcının aldığı skoru yaz
User prompt
sineği gerçek sinek silüetinde beyaz renk yap, arkaplan rengi sabit siyah olsun.
User prompt
seviye atlama hızını %10 azalt.
User prompt
10. Seviyeden sonra sinekliklerin hızı her 10 bölümde %1 artsın.
User prompt
sinekliklerin gelme hızını %25 azalt
User prompt
gelen sinekliklerin uzunlukları da rastgele değişsin, örneğin normal sinekliğin 2 katı uzunluğunda da sineklik gelsin. sinekliklerin gelme zamanlamaları her satır için rastgele değişsin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
sineklikler hep aynı düzende geliyor, geliş düzenlerini rastgele yap.
User prompt
oyun başlamadan gösterdiğin mesajı bölerek 2 satırda göster
User prompt
oyun başlamadan önce şunu ekrana yaz "Sinek ilk 5 saniye havada kalır, onu havada tutmak için mouse ile tıklayın" bu mesaj 2 saniye gözüksin ve solarak kaybolsun, sonra oyun başlasın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
oyunun arkaplan rengi siyah renk yap, değişen renkler olmasın.
User prompt
oyunun arkaplanı siyah olsun
User prompt
arkaplan siyah olsun
User prompt
oyunda 100 seviye olsun, zorluk derecesi artmasın, bu zorluk edrecesi iyi. gerçek sinek silüeti kullan, gerçek sineklik silüeti kullan.
User prompt
oyun başlayınca 5 saniye boyunca sinek havada kalsın, daha sonra kullanıcı mouse ile tıklamazsa sinek yere düşsün ve oyun sona ersin. sineğin kalçtığı renkli aparatlar daha fazla ve her satırda gelsin,
Code edit (1 edits merged)
Please save this source code
User prompt
Sinek Kaçışı: Renkli Tuzaklardan Kurtul!
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Fly class var Fly = Container.expand(function () { var self = Container.call(this); var flyAsset = self.attachAsset('fly', { anchorX: 0.5, anchorY: 0.5 }); self.width = flyAsset.width; self.height = flyAsset.height; // Physics self.vy = 0; self.gravity = 1.2; self.lift = -28; // For touch controls self.flap = function () { self.vy = self.lift; }; // Update position self.update = function () { self.vy += self.gravity; self.y += self.vy; // Clamp to screen if (self.y < self.height / 2) { self.y = self.height / 2; self.vy = 0; } if (self.y > 2732 - self.height / 2) { self.y = 2732 - self.height / 2; self.vy = 0; } }; return self; }); // Swatter class var Swatter = Container.expand(function () { var self = Container.call(this); // Swatter types and their point values var swatterTypes = [{ id: 'swatter_red', points: 50 }, { id: 'swatter_yellow', points: 35 }, { id: 'swatter_green', points: 20 }, { id: 'swatter_blue', points: 60 }]; // Randomly select a type var typeIndex = Math.floor(Math.random() * swatterTypes.length); self.type = swatterTypes[typeIndex]; self.points = self.type.points; // Attach asset var swatterAsset = self.attachAsset(self.type.id, { anchorX: 0.5, anchorY: 0.5 }); // Set initial position and speed self.x = 2048 + 120; // Start just off the right edge self.y = 200 + Math.floor(Math.random() * (2732 - 400)); self.speed = 12 + Math.random() * 6; // Will be increased by level // For collision detection self.update = function () { self.x -= self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x7ec850 // Initial background: forest }); /**** * Game Code ****/ // Backgrounds (just colored rectangles for MVP, can be replaced with images later) // Sinek öldürücü aparat (swatter) assets, each color is a different point value // Sinek (fly) asset // Level backgrounds var backgrounds = ['bg_forest', 'bg_home', 'bg_city']; // Level config var levelCount = 10; var currentLevel = 1; var swatterInterval = 90; // ticks between swatters, will decrease with level var swatterSpeedBonus = 0; // increases with level // Score var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Level text var levelTxt = new Text2('Seviye 1', { size: 70, fill: 0xFFFFFF }); levelTxt.anchor.set(0.5, 0); LK.gui.top.addChild(levelTxt); levelTxt.y = 120; // Background node var bgNode = LK.getAsset('bg_forest', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); game.addChild(bgNode); // Fly var fly = new Fly(); game.addChild(fly); fly.x = 400; fly.y = 2732 / 2; // Swatters array var swatters = []; // For touch controls var isTouching = false; // For level progression var nextLevelScore = 100; var levelScoreStep = 100; // Set background for level function setBackgroundForLevel(level) { var bgIndex = (level - 1) % backgrounds.length; var bgId = backgrounds[bgIndex]; // Remove old background if (bgNode && bgNode.parent) { bgNode.parent.removeChild(bgNode); } bgNode = LK.getAsset(bgId, { anchorX: 0, anchorY: 0, x: 0, y: 0 }); game.addChildAt(bgNode, 0); } // Level up function levelUp() { currentLevel++; if (currentLevel > levelCount) { LK.showYouWin(); return; } setBackgroundForLevel(currentLevel); levelTxt.setText('Seviye ' + currentLevel); // Increase difficulty swatterInterval = Math.max(40, 90 - (currentLevel - 1) * 5); swatterSpeedBonus = (currentLevel - 1) * 2.5; nextLevelScore += levelScoreStep; // Flash background for level up LK.effects.flashScreen(0xffff00, 600); } // Touch/drag controls game.down = function (x, y, obj) { isTouching = true; fly.flap(); }; game.up = function (x, y, obj) { isTouching = false; }; game.move = function (x, y, obj) { // Optional: allow dragging fly up/down if (isTouching) { fly.y = y; } }; // Main update loop game.update = function () { // Update fly fly.update(); // Spawn swatters if (LK.ticks % swatterInterval === 0) { var swatter = new Swatter(); swatter.speed += swatterSpeedBonus; swatters.push(swatter); game.addChild(swatter); } // Update swatters for (var i = swatters.length - 1; i >= 0; i--) { var sw = swatters[i]; sw.update(); // Collision if (fly.intersects(sw)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Off screen if (sw.x < -200) { // Award points for successful dodge LK.setScore(LK.getScore() + sw.points); scoreTxt.setText(LK.getScore()); // Level up if needed if (LK.getScore() >= nextLevelScore) { levelUp(); } sw.destroy(); swatters.splice(i, 1); } } }; // Reset game state on restart LK.on('gameStart', function () { // Reset variables currentLevel = 1; swatterInterval = 90; swatterSpeedBonus = 0; nextLevelScore = 100; setBackgroundForLevel(currentLevel); levelTxt.setText('Seviye 1'); LK.setScore(0); scoreTxt.setText('0'); // Remove all swatters for (var i = 0; i < swatters.length; i++) { swatters[i].destroy(); } swatters = []; // Reset fly fly.x = 400; fly.y = 2732 / 2; fly.vy = 0; }); /* End of MVP */
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,236 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// Fly class
+var Fly = Container.expand(function () {
+ var self = Container.call(this);
+ var flyAsset = self.attachAsset('fly', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.width = flyAsset.width;
+ self.height = flyAsset.height;
+ // Physics
+ self.vy = 0;
+ self.gravity = 1.2;
+ self.lift = -28;
+ // For touch controls
+ self.flap = function () {
+ self.vy = self.lift;
+ };
+ // Update position
+ self.update = function () {
+ self.vy += self.gravity;
+ self.y += self.vy;
+ // Clamp to screen
+ if (self.y < self.height / 2) {
+ self.y = self.height / 2;
+ self.vy = 0;
+ }
+ if (self.y > 2732 - self.height / 2) {
+ self.y = 2732 - self.height / 2;
+ self.vy = 0;
+ }
+ };
+ return self;
+});
+// Swatter class
+var Swatter = Container.expand(function () {
+ var self = Container.call(this);
+ // Swatter types and their point values
+ var swatterTypes = [{
+ id: 'swatter_red',
+ points: 50
+ }, {
+ id: 'swatter_yellow',
+ points: 35
+ }, {
+ id: 'swatter_green',
+ points: 20
+ }, {
+ id: 'swatter_blue',
+ points: 60
+ }];
+ // Randomly select a type
+ var typeIndex = Math.floor(Math.random() * swatterTypes.length);
+ self.type = swatterTypes[typeIndex];
+ self.points = self.type.points;
+ // Attach asset
+ var swatterAsset = self.attachAsset(self.type.id, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Set initial position and speed
+ self.x = 2048 + 120; // Start just off the right edge
+ self.y = 200 + Math.floor(Math.random() * (2732 - 400));
+ self.speed = 12 + Math.random() * 6; // Will be increased by level
+ // For collision detection
+ self.update = function () {
+ self.x -= self.speed;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x7ec850 // Initial background: forest
+});
+
+/****
+* Game Code
+****/
+// Backgrounds (just colored rectangles for MVP, can be replaced with images later)
+// Sinek öldürücü aparat (swatter) assets, each color is a different point value
+// Sinek (fly) asset
+// Level backgrounds
+var backgrounds = ['bg_forest', 'bg_home', 'bg_city'];
+// Level config
+var levelCount = 10;
+var currentLevel = 1;
+var swatterInterval = 90; // ticks between swatters, will decrease with level
+var swatterSpeedBonus = 0; // increases with level
+// Score
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Level text
+var levelTxt = new Text2('Seviye 1', {
+ size: 70,
+ fill: 0xFFFFFF
+});
+levelTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(levelTxt);
+levelTxt.y = 120;
+// Background node
+var bgNode = LK.getAsset('bg_forest', {
+ anchorX: 0,
+ anchorY: 0,
+ x: 0,
+ y: 0
+});
+game.addChild(bgNode);
+// Fly
+var fly = new Fly();
+game.addChild(fly);
+fly.x = 400;
+fly.y = 2732 / 2;
+// Swatters array
+var swatters = [];
+// For touch controls
+var isTouching = false;
+// For level progression
+var nextLevelScore = 100;
+var levelScoreStep = 100;
+// Set background for level
+function setBackgroundForLevel(level) {
+ var bgIndex = (level - 1) % backgrounds.length;
+ var bgId = backgrounds[bgIndex];
+ // Remove old background
+ if (bgNode && bgNode.parent) {
+ bgNode.parent.removeChild(bgNode);
+ }
+ bgNode = LK.getAsset(bgId, {
+ anchorX: 0,
+ anchorY: 0,
+ x: 0,
+ y: 0
+ });
+ game.addChildAt(bgNode, 0);
+}
+// Level up
+function levelUp() {
+ currentLevel++;
+ if (currentLevel > levelCount) {
+ LK.showYouWin();
+ return;
+ }
+ setBackgroundForLevel(currentLevel);
+ levelTxt.setText('Seviye ' + currentLevel);
+ // Increase difficulty
+ swatterInterval = Math.max(40, 90 - (currentLevel - 1) * 5);
+ swatterSpeedBonus = (currentLevel - 1) * 2.5;
+ nextLevelScore += levelScoreStep;
+ // Flash background for level up
+ LK.effects.flashScreen(0xffff00, 600);
+}
+// Touch/drag controls
+game.down = function (x, y, obj) {
+ isTouching = true;
+ fly.flap();
+};
+game.up = function (x, y, obj) {
+ isTouching = false;
+};
+game.move = function (x, y, obj) {
+ // Optional: allow dragging fly up/down
+ if (isTouching) {
+ fly.y = y;
+ }
+};
+// Main update loop
+game.update = function () {
+ // Update fly
+ fly.update();
+ // Spawn swatters
+ if (LK.ticks % swatterInterval === 0) {
+ var swatter = new Swatter();
+ swatter.speed += swatterSpeedBonus;
+ swatters.push(swatter);
+ game.addChild(swatter);
+ }
+ // Update swatters
+ for (var i = swatters.length - 1; i >= 0; i--) {
+ var sw = swatters[i];
+ sw.update();
+ // Collision
+ if (fly.intersects(sw)) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ // Off screen
+ if (sw.x < -200) {
+ // Award points for successful dodge
+ LK.setScore(LK.getScore() + sw.points);
+ scoreTxt.setText(LK.getScore());
+ // Level up if needed
+ if (LK.getScore() >= nextLevelScore) {
+ levelUp();
+ }
+ sw.destroy();
+ swatters.splice(i, 1);
+ }
+ }
+};
+// Reset game state on restart
+LK.on('gameStart', function () {
+ // Reset variables
+ currentLevel = 1;
+ swatterInterval = 90;
+ swatterSpeedBonus = 0;
+ nextLevelScore = 100;
+ setBackgroundForLevel(currentLevel);
+ levelTxt.setText('Seviye 1');
+ LK.setScore(0);
+ scoreTxt.setText('0');
+ // Remove all swatters
+ for (var i = 0; i < swatters.length; i++) {
+ swatters[i].destroy();
+ }
+ swatters = [];
+ // Reset fly
+ fly.x = 400;
+ fly.y = 2732 / 2;
+ fly.vy = 0;
+});
+/* End of MVP */
\ No newline at end of file