User prompt
Add rounds, first round minors, second round medium-small mixed, third round medium, fourth round major-medium, fifth round Major, sixth round all. If the player does all of them, he wins
User prompt
Let there be broken ships in between, when we collect those ships, our 20 lives will increase, if our health is full, it will increase our health by 10 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the medium ones reduce 10 lives, and the large ones reduce 20 lives
User prompt
Make a health bar, let our health be 100, let the waves reduce our health by 5 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make normals wawes 50% faster, mid wawes 25% faster,Big wawes 10% Faster ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Remove score
User prompt
Make a sea game, let the waves come, let's escape from the waves ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Wave Escape
Initial prompt
Play a sea game, let the waves come around us, let's escape from the waves.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Boat = Container.expand(function () {
var self = Container.call(this);
// Attach boat graphics
var boatGraphics = self.attachAsset('boat', {
anchorX: 0.5,
anchorY: 0.5
});
// Boat properties
self.isDragging = false;
self.lastIntersecting = false;
// Position boat in center initially
self.x = 2048 / 2;
self.y = 2732 / 2;
self.update = function () {
// Add gentle bobbing animation
boatGraphics.rotation = Math.sin(LK.ticks * 0.05) * 0.1;
};
return self;
});
// Game variables
var Wave = Container.expand(function (waveType, direction) {
var self = Container.call(this);
// Default parameters
waveType = waveType || 'wave_medium';
direction = direction || 'down';
// Attach wave graphics
var waveGraphics = self.attachAsset(waveType, {
anchorX: 0.5,
anchorY: 0.5
});
// Wave properties
self.speed = 3;
self.direction = direction;
self.waveType = waveType;
// Set initial position based on direction
self.setStartPosition = function () {
switch (self.direction) {
case 'down':
self.x = Math.random() * 2048;
self.y = -200;
break;
case 'up':
self.x = Math.random() * 2048;
self.y = 2732 + 200;
break;
case 'right':
self.x = -200;
self.y = Math.random() * 2732;
break;
case 'left':
self.x = 2048 + 200;
self.y = Math.random() * 2732;
break;
}
};
// Initialize starting position
self.setStartPosition();
// Track last position for off-screen detection
self.lastX = self.x;
self.lastY = self.y;
self.update = function () {
// Move wave based on direction
switch (self.direction) {
case 'down':
self.y += self.speed;
break;
case 'up':
self.y -= self.speed;
break;
case 'right':
self.x += self.speed;
break;
case 'left':
self.x -= self.speed;
break;
}
// Add subtle floating animation
waveGraphics.y = Math.sin(LK.ticks * 0.1 + self.x * 0.01) * 10;
};
// Check if wave is off screen
self.isOffScreen = function () {
return self.x < -300 || self.x > 2348 || self.y < -300 || self.y > 3032;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1E3A5F // Deep ocean blue
});
/****
* Game Code
****/
// Game variables
// Wave assets - different sizes for variety
// Boat asset
// Sound effects
// Tween library for smooth wave animations and effects
var waves = [];
var boat;
var dragNode = null;
var gameStartTime = LK.ticks;
var waveSpawnTimer = 0;
var difficulty = 1;
// Create title text
var titleTxt = new Text2('Wave Escape', {
size: 120,
fill: 0x87CEEB
});
titleTxt.anchor.set(0.5, 0);
titleTxt.y = 100;
LK.gui.top.addChild(titleTxt);
// Fade out title after 3 seconds
LK.setTimeout(function () {
tween(titleTxt, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
titleTxt.destroy();
}
});
}, 3000);
// Create boat
boat = game.addChild(new Boat());
// Wave directions for variety
var waveDirections = ['down', 'up', 'left', 'right'];
var waveTypes = ['wave_small', 'wave_medium', 'wave_large'];
// Handle mouse/touch movement
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = x;
dragNode.y = y;
// Keep boat within screen bounds
if (dragNode.x < 40) dragNode.x = 40;
if (dragNode.x > 2008) dragNode.x = 2008;
if (dragNode.y < 40) dragNode.y = 40;
if (dragNode.y > 2692) dragNode.y = 2692;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Start dragging the boat
dragNode = boat;
boat.isDragging = true;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
if (boat) boat.isDragging = false;
};
// Spawn wave function
function spawnWave() {
var direction = waveDirections[Math.floor(Math.random() * waveDirections.length)];
var waveType = waveTypes[Math.floor(Math.random() * waveTypes.length)];
// Adjust spawn chance based on direction for balance
if (Math.random() > 0.7) {
var newWave = new Wave(waveType, direction);
newWave.speed += difficulty * 0.5; // Increase speed with difficulty
waves.push(newWave);
game.addChild(newWave);
}
}
game.update = function () {
// Update survival time
var survivalTime = Math.floor((LK.ticks - gameStartTime) / 60);
// Increase difficulty over time
difficulty = 1 + survivalTime / 30;
// Spawn waves with increasing frequency
waveSpawnTimer++;
var spawnRate = Math.max(30 - Math.floor(difficulty * 5), 10);
if (waveSpawnTimer >= spawnRate) {
spawnWave();
waveSpawnTimer = 0;
}
// Update and check waves
for (var i = waves.length - 1; i >= 0; i--) {
var wave = waves[i];
// Initialize last position tracking
if (wave.lastIntersecting === undefined) {
wave.lastIntersecting = false;
}
// Check for collision with boat
var currentIntersecting = wave.intersects(boat);
if (!wave.lastIntersecting && currentIntersecting) {
// Collision detected - game over!
LK.getSound('wave_crash').play();
// Flash effect on collision
tween(boat, {
alpha: 0.3
}, {
duration: 100,
onFinish: function onFinish() {
tween(boat, {
alpha: 1
}, {
duration: 100
});
}
});
LK.effects.flashScreen(0x4A90E2, 1500);
LK.showGameOver();
return;
}
// Remove waves that are off screen
if (wave.isOffScreen()) {
wave.destroy();
waves.splice(i, 1);
continue;
}
// Update last intersecting state
wave.lastIntersecting = currentIntersecting;
}
// Add occasional splash sound for atmosphere
if (LK.ticks % 300 === 0 && Math.random() > 0.7) {
LK.getSound('splash').play();
}
// Victory condition - survive for 5 minutes
if (survivalTime >= 300) {
LK.showYouWin();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -112,15 +112,8 @@
var dragNode = null;
var gameStartTime = LK.ticks;
var waveSpawnTimer = 0;
var difficulty = 1;
-// Create score display
-var scoreTxt = new Text2('Score: 0', {
- size: 80,
- fill: 0xFFFFFF
-});
-scoreTxt.anchor.set(0.5, 0);
-LK.gui.top.addChild(scoreTxt);
// Create title text
var titleTxt = new Text2('Wave Escape', {
size: 120,
fill: 0x87CEEB
@@ -179,12 +172,10 @@
game.addChild(newWave);
}
}
game.update = function () {
- // Update survival time score
+ // Update survival time
var survivalTime = Math.floor((LK.ticks - gameStartTime) / 60);
- LK.setScore(survivalTime);
- scoreTxt.setText('Score: ' + survivalTime);
// Increase difficulty over time
difficulty = 1 + survivalTime / 30;
// Spawn waves with increasing frequency
waveSpawnTimer++;