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); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1; self.update = function () { 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; // 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 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(); obstacle.x = 100 + Math.random() * (2048 - 200); obstacle.y = 2732 + obstacle.height; 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); // 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() { 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(); // Game over only on significant collisions if (Math.random() < 0.3) { // Only end game for more serious collisions isGameOver = true; LK.showGameOver(); } else { // Just remove the obstacle for minor collisions obstacle.destroy(); obstacles.splice(i, 1); } } } } // 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.01 + waterLevel / 15000; // 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 for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; if (obstacle.shouldRemove) { obstacle.destroy(); obstacles.splice(i, 1); } } // Check for fish catch checkFishCatch(); // Check for obstacle collisions checkObstacleCollisions(); // Winning condition - reaching a certain score if (score >= 500 && !isGameOver) { LK.showYouWin(); isGameOver = true; } }; // Play background music LK.playMusic('backgroundNature', { fade: { start: 0, end: 0.3, duration: 1000 } });
/****
* 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);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1;
self.update = function () {
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;
// 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 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();
obstacle.x = 100 + Math.random() * (2048 - 200);
obstacle.y = 2732 + obstacle.height;
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);
// 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() {
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();
// Game over only on significant collisions
if (Math.random() < 0.3) {
// Only end game for more serious collisions
isGameOver = true;
LK.showGameOver();
} else {
// Just remove the obstacle for minor collisions
obstacle.destroy();
obstacles.splice(i, 1);
}
}
}
}
// 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.01 + waterLevel / 15000;
// 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
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.shouldRemove) {
obstacle.destroy();
obstacles.splice(i, 1);
}
}
// Check for fish catch
checkFishCatch();
// Check for obstacle collisions
checkObstacleCollisions();
// Winning condition - reaching a certain score
if (score >= 500 && !isGameOver) {
LK.showYouWin();
isGameOver = true;
}
};
// Play background music
LK.playMusic('backgroundNature', {
fade: {
start: 0,
end: 0.3,
duration: 1000
}
});
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