User prompt
add damage if you under 200 point you can take damage from middlefish and if you under 500 point you take damage from large fish
User prompt
add damage point to the score based
User prompt
add health bar and if you hit bigger fishes you lose health point
User prompt
add ship to the toop
User prompt
add some people swimming and some beaches at the top and if you up to 1000 point you can eat them
User prompt
add shell to the ocean floor
User prompt
add ocean floor
User prompt
add background some plants and ocean theme
User prompt
add blood effect to dead fishes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make fishes way too slower and add map when shark tries to get out of the map
User prompt
make shark slower
User prompt
make shark can go everywhere in the map
User prompt
can you make shark can be moved by the mouse cursor or fingers direction
User prompt
can you give obstackle a up and down animation ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
can you add different scores to the fishes small fish 10 medium fish 25 large fish 50 points
User prompt
add score system and up to 200 points you can only eat small fishes if you above 200 pointsyou cant start to eat medium fishes and if you above 500 points you can start to eat large fishes. İf you can can you make bigger the shark when your score is increased ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Hungry Shark Feast
Initial prompt
give me a hungry shark game which is infinite and moving meals
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Fish = Container.expand(function (type) { var self = Container.call(this); var fishType = type || 'small'; var fishGraphics = self.attachAsset(fishType + 'Fish', { anchorX: 0.5, anchorY: 0.5 }); self.fishType = fishType; self.speed = -4 - Math.random() * 2; self.points = fishType === 'small' ? 10 : fishType === 'medium' ? 25 : 50; self.waveAmplitude = Math.random() * 100 + 50; self.waveFrequency = Math.random() * 0.05 + 0.02; self.waveOffset = Math.random() * Math.PI * 2; self.startY = self.y; self.movePattern = Math.random() < 0.7 ? 'straight' : 'wave'; self.update = function () { self.x += self.speed; if (self.movePattern === 'wave') { self.y = self.startY + Math.sin(self.x * self.waveFrequency + self.waveOffset) * self.waveAmplitude; } }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -5; self.update = function () { self.x += self.speed; }; return self; }); var Shark = Container.expand(function () { var self = Container.call(this); var sharkGraphics = self.attachAsset('shark', { anchorX: 0.5, anchorY: 0.5 }); self.targetY = 2732 / 2; self.speed = 3; self.scaleX = 1.0; self.scaleY = 1.0; self.update = function () { // Smooth movement towards target Y position var diff = self.targetY - self.y; self.y += diff * 0.1; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006994 }); /**** * Game Code ****/ var shark = game.addChild(new Shark()); shark.x = 300; shark.y = 2732 / 2; var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); LK.gui.topRight.addChild(scoreTxt); scoreTxt.x = -20; scoreTxt.y = 20; var fish = []; var obstacles = []; var gameSpeed = 1; var spawnTimer = 0; var obstacleTimer = 0; var speedIncreaseTimer = 0; // Dragging variables var isDragging = false; var dragStartY = 0; var sharkStartY = 0; function spawnFish() { var fishTypes = ['small', 'small', 'small', 'medium', 'medium', 'large']; var type = fishTypes[Math.floor(Math.random() * fishTypes.length)]; var newFish = new Fish(type); newFish.x = 2048 + 50; newFish.y = Math.random() * (2732 - 200) + 100; newFish.startY = newFish.y; fish.push(newFish); game.addChild(newFish); } function spawnObstacle() { var newObstacle = new Obstacle(); newObstacle.x = 2048 + 50; newObstacle.y = Math.random() * (2732 - 200) + 100; obstacles.push(newObstacle); game.addChild(newObstacle); } game.down = function (x, y, obj) { isDragging = true; dragStartY = y; sharkStartY = shark.targetY; }; game.move = function (x, y, obj) { if (isDragging) { var deltaY = y - dragStartY; shark.targetY = Math.max(60, Math.min(2732 - 60, sharkStartY + deltaY)); } }; game.up = function (x, y, obj) { isDragging = false; }; game.update = function () { spawnTimer++; obstacleTimer++; speedIncreaseTimer++; // Spawn fish if (spawnTimer >= Math.max(30 - Math.floor(gameSpeed), 15)) { spawnFish(); spawnTimer = 0; } // Spawn obstacles occasionally if (obstacleTimer >= Math.max(200 - Math.floor(gameSpeed * 10), 100)) { if (Math.random() < 0.3) { spawnObstacle(); } obstacleTimer = 0; } // Increase game speed over time if (speedIncreaseTimer >= 300) { gameSpeed += 0.1; speedIncreaseTimer = 0; } // Update and check fish for (var i = fish.length - 1; i >= 0; i--) { var currentFish = fish[i]; // Initialize tracking variables if (currentFish.lastX === undefined) currentFish.lastX = currentFish.x; if (currentFish.lastIntersecting === undefined) currentFish.lastIntersecting = false; // Check if fish went off screen if (currentFish.lastX >= -100 && currentFish.x < -100) { currentFish.destroy(); fish.splice(i, 1); continue; } // Check collision with shark var currentIntersecting = shark.intersects(currentFish); if (!currentFish.lastIntersecting && currentIntersecting) { var currentScore = LK.getScore(); var canEat = false; // Check if shark can eat this fish type based on score if (currentFish.fishType === 'small') { canEat = true; // Can always eat small fish } else if (currentFish.fishType === 'medium') { canEat = currentScore >= 200; // Can eat medium fish after 200 points } else if (currentFish.fishType === 'large') { canEat = currentScore >= 500; // Can eat large fish after 500 points } if (canEat) { // Fish eaten var newScore = currentScore + currentFish.points; LK.setScore(newScore); scoreTxt.setText('Score: ' + newScore); LK.getSound('eat').play(); // Scale shark based on score milestones var newScale = 1.0; if (newScore >= 500) { newScale = 1.5; } else if (newScore >= 200) { newScale = 1.25; } // Animate shark scaling if it changed if (shark.scaleX !== newScale) { tween(shark, { scaleX: newScale, scaleY: newScale }, { duration: 300, easing: tween.easeOut }); } // Flash effect LK.effects.flashObject(currentFish, 0x00ff00, 200); currentFish.destroy(); fish.splice(i, 1); continue; } else { // Can't eat this fish - bounce back effect LK.effects.flashObject(currentFish, 0xff0000, 200); LK.effects.flashObject(shark, 0xff0000, 200); } } // Update tracking variables currentFish.lastX = currentFish.x; currentFish.lastIntersecting = currentIntersecting; } // Update and check obstacles for (var j = obstacles.length - 1; j >= 0; j--) { var currentObstacle = obstacles[j]; // Initialize tracking variables if (currentObstacle.lastX === undefined) currentObstacle.lastX = currentObstacle.x; if (currentObstacle.lastIntersecting === undefined) currentObstacle.lastIntersecting = false; // Check if obstacle went off screen if (currentObstacle.lastX >= -100 && currentObstacle.x < -100) { currentObstacle.destroy(); obstacles.splice(j, 1); continue; } // Check collision with shark var currentIntersecting = shark.intersects(currentObstacle); if (!currentObstacle.lastIntersecting && currentIntersecting) { // Hit obstacle - game over LK.getSound('hit').play(); LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Update tracking variables currentObstacle.lastX = currentObstacle.x; currentObstacle.lastIntersecting = currentIntersecting; } // Keep shark within bounds if (shark.y < 30) shark.y = 30; if (shark.y > 2732 - 30) shark.y = 2732 - 30; }; // Play background music LK.playMusic('ocean');
===================================================================
--- original.js
+++ change.js
@@ -14,9 +14,9 @@
anchorY: 0.5
});
self.fishType = fishType;
self.speed = -4 - Math.random() * 2;
- self.points = fishType === 'small' ? 1 : fishType === 'medium' ? 3 : 5;
+ self.points = fishType === 'small' ? 10 : fishType === 'medium' ? 25 : 50;
self.waveAmplitude = Math.random() * 100 + 50;
self.waveFrequency = Math.random() * 0.05 + 0.02;
self.waveOffset = Math.random() * Math.PI * 2;
self.startY = self.y;
big fish. In-Game asset. 2d. High contrast. No shadows
shark. In-Game asset. 2d. High contrast. No shadows
fish. In-Game asset. 2d. High contrast. No shadows
jelly fish. In-Game asset. 2d. High contrast. No shadows
small fish. In-Game asset. 2d. High contrast. No shadows
large coral. In-Game asset. 2d. High contrast. No shadows
seaweed. In-Game asset. 2d. High contrast. No shadows
shell. In-Game asset. 2d. High contrast. No shadows
sky. In-Game asset. 2d. High contrast. No shadows
swimming person. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
person on a cano. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
heart. In-Game asset. 2d. High contrast. No shadows