User prompt
simple swipe boat control
User prompt
fix swipe control boal
User prompt
make smooth control a boat
User prompt
smoot swipe control a boat no bounching
User prompt
smooth swipe control boat
User prompt
swipe to control boat
User prompt
increase lure speed fishing line
User prompt
fishingline speed movement
User prompt
increase speed fish
User prompt
increase speed legendary fish
User prompt
remove the interface depth feature
User prompt
delete text DEEP
User prompt
Move the distance between the boat and the fish on the screen so that they don't look close
User prompt
Keep the distance between the boat and the fish on the screen
User prompt
extend the fishing line to the bottom of the screen
User prompt
reduce the number of fish so it doesn't lag
User prompt
reduce the number of obstacles so there is no lag
User prompt
lengthen the fishing line
User prompt
boat explodes after hitting obstacle
User prompt
obstacles are sea mines
User prompt
reduce quantity of obstacle
User prompt
unlimited number of scores ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
infinite score
User prompt
extreme reduce obstacle
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Boat = Container.expand(function () { var self = Container.call(this); var boatGraphics = self.attachAsset('boat', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.isCasting = false; self.lineLength = 0; self.maxLineLength = 300; self.lineSpeed = 3; var fishingLine = self.attachAsset('fishingLine', { anchorX: 0.5, anchorY: 0, x: 0, y: 50, visible: false, height: 0 }); var fishHook = self.attachAsset('fishHook', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 50, visible: false }); self.castLine = function () { if (!self.isCasting) { self.isCasting = true; fishingLine.visible = true; fishHook.visible = true; LK.getSound('cast').play(); } }; self.reelIn = function () { self.isCasting = false; }; self.update = function () { if (self.isCasting && self.lineLength < self.maxLineLength) { self.lineLength += self.lineSpeed; fishingLine.height = self.lineLength; fishHook.y = 50 + self.lineLength; } else if (!self.isCasting && self.lineLength > 0) { self.lineLength -= self.lineSpeed * 2; fishingLine.height = self.lineLength; fishHook.y = 50 + self.lineLength; } if (self.lineLength <= 0 && !self.isCasting) { fishingLine.visible = false; fishHook.visible = false; self.lineLength = 0; } }; self.getHookPosition = function () { return { x: self.x, y: self.y + 50 + self.lineLength }; }; self.down = function (x, y, obj) { self.castLine(); }; self.up = function (x, y, obj) { self.reelIn(); }; return self; }); var Fish = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'normal'; var assetId, points; switch (self.type) { case 'rare': assetId = 'rareFish'; points = 50; self.speed = 3; break; case 'legendary': assetId = 'legendaryFish'; points = 100; self.speed = 4; break; default: assetId = 'fish'; points = 10; self.speed = 2; } self.points = points; var fishGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); // Randomly set the direction (left or right) self.direction = Math.random() > 0.5 ? 1 : -1; // If moving right, flip the fish if (self.direction > 0) { fishGraphics.scaleX = -1; } self.update = function () { self.x += self.speed * self.direction; // If fish goes off screen, remove it if (self.direction > 0 && self.x > 2048 + fishGraphics.width || self.direction < 0 && self.x < -fishGraphics.width) { self.shouldRemove = true; } }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); // Sea mine asset (round shape with spikes) var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5, tint: 0x333333 // Dark gray color for sea mines }); // Create spikes around the mine (using rotation) for (var i = 0; i < 8; i++) { var spike = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0, scaleX: 0.2, scaleY: 0.5, tint: 0x333333 }); spike.rotation = i * Math.PI / 4; spike.x = Math.cos(spike.rotation) * 20; spike.y = Math.sin(spike.rotation) * 20; } self.speed = 0.1; // Extremely reduced obstacle speed // Add pulsing animation effect self.pulsePhase = Math.random() * Math.PI * 2; // Random starting phase self.update = function () { // Pulsing animation for sea mine var pulseFactor = 0.1 * Math.sin(self.pulsePhase); obstacleGraphics.scaleX = 1 + pulseFactor; obstacleGraphics.scaleY = 1 + pulseFactor; self.pulsePhase += 0.05; self.y -= self.speed; if (self.y < -obstacleGraphics.height) { self.shouldRemove = true; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables var boat; var fishes = []; var obstacles = []; var score = 0; var isGameOver = false; var waterLevel = 0; var fishSpawnRate = 0.02; var obstacleSpawnRate = 0.01; var backgroundSpeed = 1; var highScore = storage.highScore || 0; // Create water background var water = LK.getAsset('water', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); game.addChild(water); // Initialize boat boat = new Boat(); boat.x = 2048 / 2; boat.y = 300; game.addChild(boat); // Create score text var scoreTxt = new Text2('Score: 0', { size: 70, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create high score text var highScoreTxt = new Text2('High Score: ' + highScore, { size: 50, fill: 0xFFD700 }); highScoreTxt.anchor.set(0.5, 0); highScoreTxt.y = 150; LK.gui.top.addChild(highScoreTxt); // Create depth indicator var depthTxt = new Text2('Depth: 0m', { size: 60, fill: 0xFFFFFF }); depthTxt.anchor.set(0.5, 0); depthTxt.y = 80; LK.gui.top.addChild(depthTxt); // Handle touch/click events for the game area game.down = function (x, y, obj) { if (!isGameOver && !boat.isCasting) { boat.castLine(); } }; game.up = function (x, y, obj) { if (!isGameOver && boat.isCasting) { boat.reelIn(); } }; // Handle touch move for navigating the boat var isDraggingBoat = false; game.move = function (x, y, obj) { if (isDraggingBoat) { boat.x = x; // Keep boat within game bounds boat.x = Math.max(boat.x, 100); boat.x = Math.min(boat.x, 2048 - 100); } }; // Drag boat horizontally boat.down = function (x, y, obj) { isDraggingBoat = true; }; boat.up = function (x, y, obj) { isDraggingBoat = false; boat.castLine(); }; // Function to spawn fish function spawnFish() { if (Math.random() < fishSpawnRate) { var fishType; var random = Math.random(); if (random < 0.05 && waterLevel > 500) { fishType = 'legendary'; } else if (random < 0.2 && waterLevel > 200) { fishType = 'rare'; } else { fishType = 'normal'; } var fish = new Fish(fishType); // Random position on left or right side if (fish.direction > 0) { fish.x = -fish.width / 2; } else { fish.x = 2048 + fish.width / 2; } // Random depth, deeper as the game progresses var minDepth = 400; var maxDepth = Math.min(2732 - 100, 400 + waterLevel); fish.y = minDepth + Math.random() * (maxDepth - minDepth); fishes.push(fish); game.addChild(fish); } } // Function to spawn obstacles function spawnObstacle() { if (Math.random() < obstacleSpawnRate) { var obstacle = new Obstacle(); // Sea mines float at varying depths obstacle.x = 100 + Math.random() * (2048 - 200); obstacle.y = 2732 + obstacle.height; // Add floating movement to sea mines obstacle.floatDirection = Math.random() > 0.5 ? 1 : -1; obstacle.floatSpeed = 0.2 + Math.random() * 0.3; obstacle.floatPhase = Math.random() * Math.PI * 2; obstacles.push(obstacle); game.addChild(obstacle); } } // Function to check if hook caught a fish function checkFishCatch() { if (!boat.isCasting) return; var hookPos = boat.getHookPosition(); for (var i = fishes.length - 1; i >= 0; i--) { var fish = fishes[i]; var distance = Math.sqrt(Math.pow(hookPos.x - fish.x, 2) + Math.pow(hookPos.y - fish.y, 2)); if (distance < 40) { // Hook caught a fish // Add points based on fish type score += fish.points; LK.setScore(score); scoreTxt.setText('Score: ' + score); // Update high score if needed if (score > highScore) { highScore = score; storage.highScore = highScore; highScoreTxt.setText('High Score: ' + highScore); // Flash high score text when broken LK.effects.flashObject(highScoreTxt, 0xFFD700, 1000); } // Play catch sound LK.getSound('catch').play(); // Flash effect LK.effects.flashObject(fish, 0xFFFFFF, 500); // Remove the fish fish.destroy(); fishes.splice(i, 1); // Reel in after catching boat.reelIn(); break; } } } // Function to check boat collision with obstacles function checkObstacleCollisions() { var _loop = function _loop() { obstacle = obstacles[i]; if (boat.intersects(obstacle)) { var _animateExplosion = function animateExplosion() { explosionSize += 0.2; obstacle.scale.set(explosionSize); obstacle.alpha -= 0.1; if (obstacle.alpha > 0) { LK.setTimeout(_animateExplosion, 30); } else { // Remove the sea mine after explosion completes obstacle.destroy(); obstacles.splice(i, 1); } }; // Hit a sea mine - create explosion effect LK.effects.flashScreen(0xFF0000, 800); LK.getSound('splash').play(); // Create explosion animation explosionSize = 1; obstacle.tint = 0xFF3300; // Explosion color _animateExplosion(); return 0; // break } // Also check if fishing line hits sea mine if (boat.isCasting) { hookPos = boat.getHookPosition(); distance = Math.sqrt(Math.pow(hookPos.x - obstacle.x, 2) + Math.pow(hookPos.y - obstacle.y, 2)); if (distance < 60) { // Hook hit a sea mine LK.effects.flashScreen(0xFF5500, 500); LK.getSound('splash').play(); // Trigger mine explosion obstacle.tint = 0xFF3300; obstacle.scale.set(1.5); LK.setTimeout(function () { obstacle.destroy(); obstacles.splice(i, 1); }, 300); // Reel in after hitting mine boat.reelIn(); return 0; // break } } }, obstacle, explosionSize, hookPos, distance, _ret; for (var i = obstacles.length - 1; i >= 0; i--) { _ret = _loop(); if (_ret === 0) break; } } // Update game loop game.update = function () { if (isGameOver) return; // Update water level (depth) waterLevel += backgroundSpeed * 0.1; depthTxt.setText('Depth: ' + Math.floor(waterLevel) + 'm'); // Increase difficulty based on depth fishSpawnRate = 0.02 + waterLevel / 10000; obstacleSpawnRate = 0.0005 + waterLevel / 50000; // Sea mines spawn rate - still reduced but slightly more frequent // Spawn game elements spawnFish(); spawnObstacle(); // Update all game objects // Update fishes for (var i = fishes.length - 1; i >= 0; i--) { var fish = fishes[i]; if (fish.shouldRemove) { fish.destroy(); fishes.splice(i, 1); } } // Update obstacles (sea mines) for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; // Add gentle floating motion to sea mines if (obstacle.floatPhase !== undefined) { obstacle.floatPhase += 0.02; obstacle.x += Math.sin(obstacle.floatPhase) * obstacle.floatSpeed * obstacle.floatDirection; } if (obstacle.shouldRemove) { obstacle.destroy(); obstacles.splice(i, 1); } } // Check for fish catch checkFishCatch(); // Check for obstacle collisions checkObstacleCollisions(); // No winning condition - allow unlimited play // Game continues indefinitely so players can achieve the highest score possible }; // Play background music LK.playMusic('backgroundNature', { fade: { start: 0, end: 0.3, duration: 1000 } });
===================================================================
--- original.js
+++ change.js
@@ -115,14 +115,36 @@
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
+ // Sea mine asset (round shape with spikes)
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ tint: 0x333333 // Dark gray color for sea mines
});
+ // Create spikes around the mine (using rotation)
+ for (var i = 0; i < 8; i++) {
+ var spike = self.attachAsset('obstacle', {
+ anchorX: 0.5,
+ anchorY: 0,
+ scaleX: 0.2,
+ scaleY: 0.5,
+ tint: 0x333333
+ });
+ spike.rotation = i * Math.PI / 4;
+ spike.x = Math.cos(spike.rotation) * 20;
+ spike.y = Math.sin(spike.rotation) * 20;
+ }
self.speed = 0.1; // Extremely reduced obstacle speed
+ // Add pulsing animation effect
+ self.pulsePhase = Math.random() * Math.PI * 2; // Random starting phase
self.update = function () {
+ // Pulsing animation for sea mine
+ var pulseFactor = 0.1 * Math.sin(self.pulsePhase);
+ obstacleGraphics.scaleX = 1 + pulseFactor;
+ obstacleGraphics.scaleY = 1 + pulseFactor;
+ self.pulsePhase += 0.05;
self.y -= self.speed;
if (self.y < -obstacleGraphics.height) {
self.shouldRemove = true;
}
@@ -246,10 +268,15 @@
// Function to spawn obstacles
function spawnObstacle() {
if (Math.random() < obstacleSpawnRate) {
var obstacle = new Obstacle();
+ // Sea mines float at varying depths
obstacle.x = 100 + Math.random() * (2048 - 200);
obstacle.y = 2732 + obstacle.height;
+ // Add floating movement to sea mines
+ obstacle.floatDirection = Math.random() > 0.5 ? 1 : -1;
+ obstacle.floatSpeed = 0.2 + Math.random() * 0.3;
+ obstacle.floatPhase = Math.random() * Math.PI * 2;
obstacles.push(obstacle);
game.addChild(obstacle);
}
}
@@ -288,18 +315,61 @@
}
}
// Function to check boat collision with obstacles
function checkObstacleCollisions() {
+ var _loop = function _loop() {
+ obstacle = obstacles[i];
+ if (boat.intersects(obstacle)) {
+ var _animateExplosion = function animateExplosion() {
+ explosionSize += 0.2;
+ obstacle.scale.set(explosionSize);
+ obstacle.alpha -= 0.1;
+ if (obstacle.alpha > 0) {
+ LK.setTimeout(_animateExplosion, 30);
+ } else {
+ // Remove the sea mine after explosion completes
+ obstacle.destroy();
+ obstacles.splice(i, 1);
+ }
+ };
+ // Hit a sea mine - create explosion effect
+ LK.effects.flashScreen(0xFF0000, 800);
+ LK.getSound('splash').play();
+ // Create explosion animation
+ explosionSize = 1;
+ obstacle.tint = 0xFF3300; // Explosion color
+ _animateExplosion();
+ return 0; // break
+ }
+ // Also check if fishing line hits sea mine
+ if (boat.isCasting) {
+ hookPos = boat.getHookPosition();
+ distance = Math.sqrt(Math.pow(hookPos.x - obstacle.x, 2) + Math.pow(hookPos.y - obstacle.y, 2));
+ if (distance < 60) {
+ // Hook hit a sea mine
+ LK.effects.flashScreen(0xFF5500, 500);
+ LK.getSound('splash').play();
+ // Trigger mine explosion
+ obstacle.tint = 0xFF3300;
+ obstacle.scale.set(1.5);
+ LK.setTimeout(function () {
+ obstacle.destroy();
+ obstacles.splice(i, 1);
+ }, 300);
+ // Reel in after hitting mine
+ boat.reelIn();
+ return 0; // break
+ }
+ }
+ },
+ obstacle,
+ explosionSize,
+ hookPos,
+ distance,
+ _ret;
for (var i = obstacles.length - 1; i >= 0; i--) {
- var obstacle = obstacles[i];
- if (boat.intersects(obstacle)) {
- // Hit an obstacle
- LK.effects.flashScreen(0xFF0000, 500);
- LK.getSound('splash').play();
- // No game over from obstacles, just remove them
- obstacle.destroy();
- obstacles.splice(i, 1);
- }
+ _ret = _loop();
+ if (_ret === 0) break;
}
}
// Update game loop
game.update = function () {
@@ -308,9 +378,9 @@
waterLevel += backgroundSpeed * 0.1;
depthTxt.setText('Depth: ' + Math.floor(waterLevel) + 'm');
// Increase difficulty based on depth
fishSpawnRate = 0.02 + waterLevel / 10000;
- obstacleSpawnRate = 0.0001 + waterLevel / 100000; // Extremely reduced obstacle spawn rate
+ obstacleSpawnRate = 0.0005 + waterLevel / 50000; // Sea mines spawn rate - still reduced but slightly more frequent
// Spawn game elements
spawnFish();
spawnObstacle();
// Update all game objects
@@ -321,11 +391,16 @@
fish.destroy();
fishes.splice(i, 1);
}
}
- // Update obstacles
+ // Update obstacles (sea mines)
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
+ // Add gentle floating motion to sea mines
+ if (obstacle.floatPhase !== undefined) {
+ obstacle.floatPhase += 0.02;
+ obstacle.x += Math.sin(obstacle.floatPhase) * obstacle.floatSpeed * obstacle.floatDirection;
+ }
if (obstacle.shouldRemove) {
obstacle.destroy();
obstacles.splice(i, 1);
}
horizontal image sea tuna. In-Game asset. 2d. High contrast. No shadows
horizontal image Snapper fish. In-Game asset. 2d. High contrast. No shadows
horizontal image blue marlin fish. In-Game asset. 2d. High contrast. No shadows
sea mine. In-Game asset. 2d. High contrast. No shadows
quite blue under water of sea
horizontal top down image submarine. In-Game asset. 2d. High contrast. No shadows
vertical harpoon head. In-Game asset. 2d. High contrast. No shadows