/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Cat = Container.expand(function () { var self = Container.call(this); var catGraphics = self.attachAsset('cat', { anchorX: 0.5, anchorY: 1.0 }); self.targetX = 1024; // Center of screen self.speed = 15; self.update = function () { // Smooth movement towards target position var diff = self.targetX - self.x; if (Math.abs(diff) > 5) { self.x += diff * 0.2; } else { self.x = self.targetX; } // Keep cat within screen bounds var halfWidth = catGraphics.width / 2; if (self.x < halfWidth) { self.x = halfWidth; self.targetX = halfWidth; } if (self.x > 2048 - halfWidth) { self.x = 2048 - halfWidth; self.targetX = 2048 - halfWidth; } }; return self; }); var Orange = Container.expand(function () { var self = Container.call(this); var orangeGraphics = self.attachAsset('orange', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.lastY = 0; self.caught = false; self.update = function () { if (!self.caught) { self.y += self.speed; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var cat; var oranges = []; var gameSpeed = 1; var orangeSpawnRate = 60; // frames between spawns var frameCount = 0; var lives = 3; // 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 lives display var livesTxt = new Text2('Lives: 3', { size: 60, fill: 0xFFFFFF }); livesTxt.anchor.set(1, 0); livesTxt.y = 100; LK.gui.topRight.addChild(livesTxt); // Create the cat cat = game.addChild(new Cat()); cat.x = 1024; // Center horizontally cat.y = 2600; // Near bottom of screen // Handle touch/mouse input function handleMove(x, y, obj) { if (cat) { cat.targetX = x; } } game.move = handleMove; game.down = function (x, y, obj) { handleMove(x, y, obj); }; // Spawn oranges function spawnOrange() { var orange = new Orange(); orange.x = Math.random() * (2048 - 160) + 80; // Random x position within bounds orange.y = -40; // Start above screen orange.lastY = orange.y; orange.speed = 6 + gameSpeed * 2; // Increase speed with game progression oranges.push(orange); game.addChild(orange); } // Update score display function updateScore() { scoreTxt.setText('Score: ' + LK.getScore()); } // Update lives display function updateLives() { livesTxt.setText('Lives: ' + lives); } game.update = function () { frameCount++; // Spawn oranges if (frameCount % Math.max(20, orangeSpawnRate - Math.floor(LK.getScore() / 5)) === 0) { spawnOrange(); } // Increase game speed over time if (frameCount % 600 === 0) { // Every 10 seconds at 60fps gameSpeed += 0.2; } // Update oranges for (var i = oranges.length - 1; i >= 0; i--) { var orange = oranges[i]; // Check if orange went off screen (missed) if (orange.lastY < 2732 && orange.y >= 2732 && !orange.caught) { // Orange hit the ground - lose a life lives--; updateLives(); if (lives <= 0) { LK.showGameOver(); return; } orange.destroy(); oranges.splice(i, 1); continue; } // Check collision with cat if (!orange.caught && orange.intersects(cat)) { // Orange caught! orange.caught = true; LK.setScore(LK.getScore() + 1); updateScore(); // Play catch sound LK.getSound('catch').play(); // Flash effect on cat LK.effects.flashObject(cat, 0xFFFFFF, 200); // Animate orange being caught tween(orange, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { orange.destroy(); } }); oranges.splice(i, 1); continue; } orange.lastY = orange.y; } // Check win condition (optional - high score achievement) if (LK.getScore() >= 100) { LK.showYouWin(); } }; // Initialize displays updateScore(); updateLives();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,179 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Cat = Container.expand(function () {
+ var self = Container.call(this);
+ var catGraphics = self.attachAsset('cat', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.targetX = 1024; // Center of screen
+ self.speed = 15;
+ self.update = function () {
+ // Smooth movement towards target position
+ var diff = self.targetX - self.x;
+ if (Math.abs(diff) > 5) {
+ self.x += diff * 0.2;
+ } else {
+ self.x = self.targetX;
+ }
+ // Keep cat within screen bounds
+ var halfWidth = catGraphics.width / 2;
+ if (self.x < halfWidth) {
+ self.x = halfWidth;
+ self.targetX = halfWidth;
+ }
+ if (self.x > 2048 - halfWidth) {
+ self.x = 2048 - halfWidth;
+ self.targetX = 2048 - halfWidth;
+ }
+ };
+ return self;
+});
+var Orange = Container.expand(function () {
+ var self = Container.call(this);
+ var orangeGraphics = self.attachAsset('orange', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.lastY = 0;
+ self.caught = false;
+ self.update = function () {
+ if (!self.caught) {
+ self.y += self.speed;
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+var cat;
+var oranges = [];
+var gameSpeed = 1;
+var orangeSpawnRate = 60; // frames between spawns
+var frameCount = 0;
+var lives = 3;
+// 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 lives display
+var livesTxt = new Text2('Lives: 3', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+livesTxt.anchor.set(1, 0);
+livesTxt.y = 100;
+LK.gui.topRight.addChild(livesTxt);
+// Create the cat
+cat = game.addChild(new Cat());
+cat.x = 1024; // Center horizontally
+cat.y = 2600; // Near bottom of screen
+// Handle touch/mouse input
+function handleMove(x, y, obj) {
+ if (cat) {
+ cat.targetX = x;
+ }
+}
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ handleMove(x, y, obj);
+};
+// Spawn oranges
+function spawnOrange() {
+ var orange = new Orange();
+ orange.x = Math.random() * (2048 - 160) + 80; // Random x position within bounds
+ orange.y = -40; // Start above screen
+ orange.lastY = orange.y;
+ orange.speed = 6 + gameSpeed * 2; // Increase speed with game progression
+ oranges.push(orange);
+ game.addChild(orange);
+}
+// Update score display
+function updateScore() {
+ scoreTxt.setText('Score: ' + LK.getScore());
+}
+// Update lives display
+function updateLives() {
+ livesTxt.setText('Lives: ' + lives);
+}
+game.update = function () {
+ frameCount++;
+ // Spawn oranges
+ if (frameCount % Math.max(20, orangeSpawnRate - Math.floor(LK.getScore() / 5)) === 0) {
+ spawnOrange();
+ }
+ // Increase game speed over time
+ if (frameCount % 600 === 0) {
+ // Every 10 seconds at 60fps
+ gameSpeed += 0.2;
+ }
+ // Update oranges
+ for (var i = oranges.length - 1; i >= 0; i--) {
+ var orange = oranges[i];
+ // Check if orange went off screen (missed)
+ if (orange.lastY < 2732 && orange.y >= 2732 && !orange.caught) {
+ // Orange hit the ground - lose a life
+ lives--;
+ updateLives();
+ if (lives <= 0) {
+ LK.showGameOver();
+ return;
+ }
+ orange.destroy();
+ oranges.splice(i, 1);
+ continue;
+ }
+ // Check collision with cat
+ if (!orange.caught && orange.intersects(cat)) {
+ // Orange caught!
+ orange.caught = true;
+ LK.setScore(LK.getScore() + 1);
+ updateScore();
+ // Play catch sound
+ LK.getSound('catch').play();
+ // Flash effect on cat
+ LK.effects.flashObject(cat, 0xFFFFFF, 200);
+ // Animate orange being caught
+ tween(orange, {
+ scaleX: 0,
+ scaleY: 0,
+ alpha: 0
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ orange.destroy();
+ }
+ });
+ oranges.splice(i, 1);
+ continue;
+ }
+ orange.lastY = orange.y;
+ }
+ // Check win condition (optional - high score achievement)
+ if (LK.getScore() >= 100) {
+ LK.showYouWin();
+ }
+};
+// Initialize displays
+updateScore();
+updateLives();
\ No newline at end of file
Haz un sprite de un gato azul sin pupilas con la boca abierta mirando arriba. In-Game asset. 2d. High contrast. No shadows
Una naranja cute. In-Game asset. 2d. High contrast. No shadows
Un corazón roto triste cute. In-Game asset. 2d. High contrast. No shadows
Un gato azul sin pupilas preocupado. In-Game asset. 2d. High contrast. No shadows
Un gato azul sin pupilas preocupado caminando. In-Game asset. 2d. High contrast. No shadows
Naranja cute preocupada. In-Game asset. 2d. High contrast. No shadows
Un bosque quemándose D:. In-Game asset. 2d. High contrast. No shadows