/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Boat class to represent the player's boat
var Boat = Container.expand(function () {
var self = Container.call(this);
var boatGraphics = self.attachAsset('boat', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10; // Boat speed
self.update = function () {
// Boat movement logic will be handled in the game move event
};
});
// Obstacle class to represent rocks and logs
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5; // Obstacle speed
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
});
// Treasure class to represent collectible treasures
var Treasure = Container.expand(function () {
var self = Container.call(this);
var treasureGraphics = self.attachAsset('treasure', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5; // Treasure speed
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background to represent the river
});
/****
* Game Code
****/
// Initialize game variables
var boat = game.addChild(new Boat());
boat.x = 2048 / 2;
boat.y = 2500;
var obstacles = [];
var treasures = [];
var score = 0;
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to handle boat movement
function handleMove(x, y, obj) {
boat.x = x;
if (boat.x < 0) boat.x = 0;
if (boat.x > 2048) boat.x = 2048;
}
// Game move event to handle swiping
game.move = handleMove;
// Game update loop
game.update = function () {
// Spawn obstacles and treasures
if (LK.ticks % 60 == 0) {
var newObstacle = new Obstacle();
newObstacle.x = Math.random() * 2048;
newObstacle.y = -50;
obstacles.push(newObstacle);
game.addChild(newObstacle);
var newTreasure = new Treasure();
newTreasure.x = Math.random() * 2048;
newTreasure.y = -50;
treasures.push(newTreasure);
game.addChild(newTreasure);
}
// Update obstacles and check for collisions
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (boat.intersects(obstacle)) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
}
// Update treasures and check for collection
for (var j = treasures.length - 1; j >= 0; j--) {
var treasure = treasures[j];
if (boat.intersects(treasure)) {
score += 10;
scoreTxt.setText('Score: ' + score);
treasure.destroy();
treasures.splice(j, 1);
}
}
}; /****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Boat class to represent the player's boat
var Boat = Container.expand(function () {
var self = Container.call(this);
var boatGraphics = self.attachAsset('boat', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10; // Boat speed
self.update = function () {
// Boat movement logic will be handled in the game move event
};
});
// Obstacle class to represent rocks and logs
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5; // Obstacle speed
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
});
// Treasure class to represent collectible treasures
var Treasure = Container.expand(function () {
var self = Container.call(this);
var treasureGraphics = self.attachAsset('treasure', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5; // Treasure speed
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background to represent the river
});
/****
* Game Code
****/
// Initialize game variables
var boat = game.addChild(new Boat());
boat.x = 2048 / 2;
boat.y = 2500;
var obstacles = [];
var treasures = [];
var score = 0;
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to handle boat movement
function handleMove(x, y, obj) {
boat.x = x;
if (boat.x < 0) boat.x = 0;
if (boat.x > 2048) boat.x = 2048;
}
// Game move event to handle swiping
game.move = handleMove;
// Game update loop
game.update = function () {
// Spawn obstacles and treasures
if (LK.ticks % 60 == 0) {
var newObstacle = new Obstacle();
newObstacle.x = Math.random() * 2048;
newObstacle.y = -50;
obstacles.push(newObstacle);
game.addChild(newObstacle);
var newTreasure = new Treasure();
newTreasure.x = Math.random() * 2048;
newTreasure.y = -50;
treasures.push(newTreasure);
game.addChild(newTreasure);
}
// Update obstacles and check for collisions
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (boat.intersects(obstacle)) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
}
// Update treasures and check for collection
for (var j = treasures.length - 1; j >= 0; j--) {
var treasure = treasures[j];
if (boat.intersects(treasure)) {
score += 10;
scoreTxt.setText('Score: ' + score);
treasure.destroy();
treasures.splice(j, 1);
}
}
};
shining moon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a single shining yellowish golden coin with the boat on it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a colorful, cartoon style boat with an orange and blue color scheme. the boat has a small flag on top, round windows and a curved hull , with the BOAT text on it with bold letters. the design is vibrant, playful and optimized for a mobile game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
white water bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
single rock. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
gold sparkle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
single gold sparkle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
red shining heart symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
whale head in octogonal box with green background asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
orange life rings asset that revive from water. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
single rounded white bubble firefly trail. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
shining sun cartoon style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
flying owl with blue gold color mix asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
coin magnet white blue red in color. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
warning asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows