User prompt
her ekranda her satırın %40'ı engelle dolu olarak gelsin
User prompt
engeller %15 daha sık gelsin
User prompt
engellerin uzunluklarını düzeltiyorum; 1x, 2x, 3x ve4x boyutlarında gelsin. oyun hızı %5 artsın
User prompt
engellerin uzunlukları 2x ve 3x olarak değişerek gelsin.
User prompt
engeller her satırdan rastgele ve bölüm geçtikçe hızları %1 artsın
User prompt
geçilen her engel 1 puan kazandırsın, geçilen her seviyeye göre kazanılan puanlar 2 kat artırılsın
User prompt
geçilen her 10 engelde 1 seviye atlansın
User prompt
engeller her satırdan farklı renklerdeki kutucuklarla farklı hızlarla gelsin
User prompt
mouse ile kendine doğru gelen engeller arasında zıplayan yumurta oyunu yap
User prompt
Please fix the bug: 'storage is not defined' in or related to this line: 'var storedUsername = storage.username;' Line Number: 648 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = safeReallyTrulyOneLevelLeaderboard;' Line Number: 586 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Timeout.tick error: tween is not defined' in or related to this line: 'tween(instructionTxt, {' Line Number: 652 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'storage is not defined' in or related to this line: 'var storedUsername = storage.username;' Line Number: 628 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'storage is not defined' in or related to this line: 'var storedUsername = storage.username;' Line Number: 628 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = reallyTrulyOneLevelLeaderboard;' Line Number: 570 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = trulyOneLevelLeaderboard;' Line Number: 550
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = oneLevelLeaderboard;' Line Number: 530 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = reallySafeLeaderboard;' Line Number: 510 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = safeFinalLeaderboard;' Line Number: 489 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = finalFlatLeaderboard;' Line Number: 468 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.leaderboard = trulyFlatLeaderboard;' Line Number: 447
/**** * Classes ****/ // Egg class: the player character var Egg = Container.expand(function () { var self = Container.call(this); var eggAsset = self.attachAsset('egg', { anchorX: 0.5, anchorY: 0.5 }); self.width = eggAsset.width; self.height = eggAsset.height; self.vy = 0; self.gravity = 2.2; self.jumpStrength = -38; self.isAlive = true; self.jump = function () { if (!self.isAlive) return; self.vy = self.jumpStrength; }; self.update = function () { if (!self.isAlive) return; 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; } }; self.die = function () { self.isAlive = false; }; return self; }); // Obstacle class: obstacles coming from the right var Obstacle = Container.expand(function () { var self = Container.call(this); var obsAsset = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.width = obsAsset.width; self.height = obsAsset.height; self.speed = 18 + Math.random() * 8; self.x = 2048 + self.width; // Randomize vertical position, but keep within screen var margin = 200; self.y = margin + Math.random() * (2732 - 2 * margin); self.update = function () { self.x -= self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb // Sky blue }); /**** * Game Code ****/ // --- Game Code --- // Create the egg and add to game var egg = new Egg(); egg.x = 400; egg.y = 2732 / 2; game.addChild(egg); // Obstacles array var obstacles = []; var obstacleTimer = 0; var obstacleInterval = 90; // frames between obstacles // Score var score = 0; var scoreTxt = new Text2('0', { size: 120, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Touch/mouse jump handler game.down = function (x, y, obj) { if (!egg.isAlive) return; egg.jump(); }; // Main update loop game.update = function () { if (!egg.isAlive) return; // Spawn obstacles obstacleTimer++; if (obstacleTimer >= obstacleInterval) { var obs = new Obstacle(); obstacles.push(obs); game.addChild(obs); obstacleTimer = 0; // Randomize next interval a bit obstacleInterval = 70 + Math.floor(Math.random() * 40); } // Update obstacles and check for collisions for (var i = obstacles.length - 1; i >= 0; i--) { var obs = obstacles[i]; // Remove if off screen if (obs.x < -obs.width) { obs.destroy(); obstacles.splice(i, 1); continue; } // Collision detection if (egg.intersects(obs)) { egg.die(); LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Score: passed obstacle if (obs.lastX === undefined) obs.lastX = obs.x; if (obs.lastX >= egg.x && obs.x < egg.x) { score++; scoreTxt.setText(score); } obs.lastX = obs.x; } };
===================================================================
--- original.js
+++ change.js
@@ -1,64 +1,26 @@
/****
* Classes
****/
-// Swatter class
-var Swatter = Container.expand(function () {
+// Egg class: the player character
+var Egg = 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, {
+ var eggAsset = self.attachAsset('egg', {
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) * 0.75; // 25% slower
- // Allow scaleX to be set after creation for random length
- self.scaleX = 1;
- // For collision detection
- self.update = function () {
- self.x -= self.speed;
- };
- return self;
-});
-// Yumurta class (formerly Fly)
-var Yumurta = 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.width = eggAsset.width;
+ self.height = eggAsset.height;
self.vy = 0;
- self.gravity = 1.2;
- self.lift = -28;
- // For touch controls
- self.flap = function () {
- self.vy = self.lift;
+ self.gravity = 2.2;
+ self.jumpStrength = -38;
+ self.isAlive = true;
+ self.jump = function () {
+ if (!self.isAlive) return;
+ self.vy = self.jumpStrength;
};
- // Update position
self.update = function () {
+ if (!self.isAlive) return;
self.vy += self.gravity;
self.y += self.vy;
// Clamp to screen
if (self.y < self.height / 2) {
@@ -69,13 +31,100 @@
self.y = 2732 - self.height / 2;
self.vy = 0;
}
};
+ self.die = function () {
+ self.isAlive = false;
+ };
return self;
});
+// Obstacle class: obstacles coming from the right
+var Obstacle = Container.expand(function () {
+ var self = Container.call(this);
+ var obsAsset = self.attachAsset('obstacle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.width = obsAsset.width;
+ self.height = obsAsset.height;
+ self.speed = 18 + Math.random() * 8;
+ self.x = 2048 + self.width;
+ // Randomize vertical position, but keep within screen
+ var margin = 200;
+ self.y = margin + Math.random() * (2732 - 2 * margin);
+ self.update = function () {
+ self.x -= self.speed;
+ };
+ return self;
+});
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000 // Initial background: black
-});
\ No newline at end of file
+ backgroundColor: 0x87ceeb // Sky blue
+});
+
+/****
+* Game Code
+****/
+// --- Game Code ---
+// Create the egg and add to game
+var egg = new Egg();
+egg.x = 400;
+egg.y = 2732 / 2;
+game.addChild(egg);
+// Obstacles array
+var obstacles = [];
+var obstacleTimer = 0;
+var obstacleInterval = 90; // frames between obstacles
+// Score
+var score = 0;
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: "#fff"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Touch/mouse jump handler
+game.down = function (x, y, obj) {
+ if (!egg.isAlive) return;
+ egg.jump();
+};
+// Main update loop
+game.update = function () {
+ if (!egg.isAlive) return;
+ // Spawn obstacles
+ obstacleTimer++;
+ if (obstacleTimer >= obstacleInterval) {
+ var obs = new Obstacle();
+ obstacles.push(obs);
+ game.addChild(obs);
+ obstacleTimer = 0;
+ // Randomize next interval a bit
+ obstacleInterval = 70 + Math.floor(Math.random() * 40);
+ }
+ // Update obstacles and check for collisions
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ var obs = obstacles[i];
+ // Remove if off screen
+ if (obs.x < -obs.width) {
+ obs.destroy();
+ obstacles.splice(i, 1);
+ continue;
+ }
+ // Collision detection
+ if (egg.intersects(obs)) {
+ egg.die();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ // Score: passed obstacle
+ if (obs.lastX === undefined) obs.lastX = obs.x;
+ if (obs.lastX >= egg.x && obs.x < egg.x) {
+ score++;
+ scoreTxt.setText(score);
+ }
+ obs.lastX = obs.x;
+ }
+};
\ No newline at end of file