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 = 2400; // Increased to reach bottom of screen (screen height is 2732, boat is at y=300)
self.lineSpeed = 3;
self.isExploding = false;
self.explodeScale = 1;
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.lastHookPosition = self.getHookPosition();
// Function to adjust fish positions to maintain distance
self.maintainFishDistance = function () {
if (!self.isCasting || !fishes || fishes.length === 0) return;
var hookPos = self.getHookPosition();
var minAllowedDistance = 300; // Minimum allowed distance between hook and fish
for (var i = 0; i < fishes.length; i++) {
var fish = fishes[i];
var verticalDistance = Math.abs(fish.y - hookPos.y);
// If fish is too close to the hook, move it away
if (verticalDistance < minAllowedDistance) {
// Determine direction to move the fish
if (fish.y > hookPos.y) {
fish.y += 5; // Move down faster
} else {
fish.y -= 5; // Move up faster
}
}
}
};
self.explode = function () {
if (self.isExploding) return;
self.isExploding = true;
boatGraphics.tint = 0xFF3300; // Fire color
function animateExplosion() {
self.explodeScale += 0.2;
boatGraphics.scale.set(self.explodeScale);
boatGraphics.alpha -= 0.1;
if (boatGraphics.alpha > 0) {
LK.setTimeout(animateExplosion, 30);
} else {
// Boat destroyed completely
self.visible = false;
isGameOver = true;
LK.showGameOver();
}
}
animateExplosion();
};
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 = 2; // Reduce speed to decrease frequency of updates
break;
case 'legendary':
assetId = 'legendaryFish';
points = 100;
self.speed = 2.5; // Reduce speed to decrease frequency of updates
break;
default:
assetId = 'fish';
points = 10;
self.speed = 1.5;
// Reduce speed to decrease frequency of updates
}
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 () {
// Only update position every other frame to reduce computational load
if (LK.ticks % 2 === 0) {
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;
}
// If boat is casting and fish is visible but too close to hook, maintain a greater distance
if (boat && boat.isCasting) {
var hookPos = boat.getHookPosition();
var verticalDistance = Math.abs(self.y - hookPos.y);
// If fish is too close to hook vertically, move it away from the hook
if (verticalDistance < 300) {
// Move fish away from hook's vertical position to maintain distance
if (self.y > hookPos.y) {
self.y += 3; // Move down faster
} else {
self.y -= 3; // Move up faster
}
}
// If fish is extremely far, still bring it back to visible area
else if (verticalDistance > 1500) {
// Move fish toward hook's vertical position, but keep distance
if (self.y > hookPos.y) {
self.y -= 1;
} else {
self.y += 1;
}
}
}
}
};
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
scaleX: 0.7,
// Smaller size to reduce impact
scaleY: 0.7 // Smaller size to reduce impact
});
// Create spikes around the mine (using rotation) - reduced number of spikes
for (var i = 0; i < 4; i++) {
// Reduced from 8 to 4 spikes
var spike = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0,
scaleX: 0.15,
scaleY: 0.4,
tint: 0x333333
});
spike.rotation = i * Math.PI / 2; // 4 spikes at 90 degree intervals
spike.x = Math.cos(spike.rotation) * 15; // Reduced distance
spike.y = Math.sin(spike.rotation) * 15; // Reduced distance
}
self.speed = 0.08; // Even more reduced obstacle speed
// Add simplified pulsing animation effect
self.pulsePhase = Math.random() * Math.PI * 2; // Random starting phase
self.update = function () {
// Pulsing animation for sea mine - update less frequently to save CPU
if (LK.ticks % 3 === 0) {
// Only update animation every 3 frames
var pulseFactor = 0.08 * Math.sin(self.pulsePhase);
obstacleGraphics.scaleX = 0.7 + pulseFactor;
obstacleGraphics.scaleY = 0.7 + pulseFactor;
self.pulsePhase += 0.03; // Slower animation
}
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() {
// Limit the maximum number of fish to prevent lag
if (fishes.length >= 10) return; // Don't create more than 10 fish at a time
// Significantly reduced spawn chance
if (Math.random() < fishSpawnRate * 0.3) {
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);
// If the boat is casting, ensure fish spawn with a good distance from the hook
if (boat.isCasting) {
var hookPos = boat.getHookPosition();
// Calculate a vertical area maintaining significant distance from the hook
var minDistance = 300; // Minimum distance from hook in pixels
var maxDistance = 1000; // Maximum distance from hook in pixels
// Create two possible spawn zones: above or below the hook with minimum distance
var lowerZoneStart = hookPos.y + minDistance;
var upperZoneEnd = hookPos.y - minDistance;
if (Math.random() < 0.5 && upperZoneEnd > 400) {
// Spawn above the hook with minimum distance
minDepth = Math.max(400, 400);
maxDepth = Math.min(upperZoneEnd, 400 + waterLevel);
} else {
// Spawn below the hook with minimum distance
minDepth = Math.max(lowerZoneStart, 400);
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() {
// Limit the maximum number of obstacles to prevent lag
if (obstacles.length >= 5) return; // Don't create more than 5 obstacles at a time
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 simple floating movement to sea mines
obstacle.floatDirection = Math.random() > 0.5 ? 1 : -1;
obstacle.floatSpeed = 0.1 + Math.random() * 0.1; // Reduced speed variation
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 < 60) {
// Increase catch radius to compensate for greater distance
// 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();
// Make boat explode
boat.explode();
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 || boat.isExploding) return;
// Increase difficulty based on depth
waterLevel += backgroundSpeed * 0.1;
depthTxt.setText('th: ' + Math.floor(waterLevel) + 'm');
// Increase difficulty based on depth
fishSpawnRate = 0.005 + waterLevel / 20000; // Further reduced fish spawn rate
obstacleSpawnRate = 0.0001 + waterLevel / 100000; // Extremely reduced sea mine spawn rate to prevent lag
// Spawn game elements
spawnFish();
spawnObstacle();
// Keep track of current hook position and maintain fish distance
if (boat.isCasting) {
boat.lastHookPosition = boat.getHookPosition();
boat.maintainFishDistance(); // Call the method to keep fish at a distance
}
// Update all game objects
// Update fishes - only process a subset each frame if there are many
var fishesToProcess = Math.min(fishes.length, 5); // Process max 5 fish per frame
for (var i = fishes.length - 1; i >= Math.max(0, fishes.length - fishesToProcess); 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 - less frequently
if (obstacle.floatPhase !== undefined && LK.ticks % 4 === 0) {
// Only update floating every 4 frames
obstacle.floatPhase += 0.01; // Slower movement
obstacle.x += Math.sin(obstacle.floatPhase) * obstacle.floatSpeed * obstacle.floatDirection * 0.5; // Reduced movement
}
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
@@ -478,9 +478,9 @@
game.update = function () {
if (isGameOver || boat.isExploding) return;
// Increase difficulty based on depth
waterLevel += backgroundSpeed * 0.1;
- depthTxt.setText('Depth: ' + Math.floor(waterLevel) + 'm');
+ depthTxt.setText('th: ' + Math.floor(waterLevel) + 'm');
// Increase difficulty based on depth
fishSpawnRate = 0.005 + waterLevel / 20000; // Further reduced fish spawn rate
obstacleSpawnRate = 0.0001 + waterLevel / 100000; // Extremely reduced sea mine spawn rate to prevent lag
// Spawn game elements
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