User prompt
Haz el sonido de muerte de el barco, el sonido será de una explosión y metal destruido callendo al mar
User prompt
Cambia el nombre de el juego a "escape from the mines by boat"
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'stop')' in or related to this line: 'backgroundBoatTween.stop();' Line Number: 392
User prompt
El barco del jugador se verá un 50% más grande en el menú de inicio
User prompt
Crea un menu de inicio donde se vea de fondo el barco del jugador pasando por el fondo
User prompt
Que que el jugador sea 50% más pequeño y que todo su cuerpo sea su hitbox
User prompt
Qúe la lancha que representa al jugador sea el 2 veces más grande al igual que su hitbox será más grande
User prompt
Cambia la imagen de el jugador por una pequeña lancha 🚤
User prompt
Que sea un menu de inicio
User prompt
Ahora agrégale un botón de inicio para empezar la partida
User prompt
Que los brazos y piernas del jugador se muevan un poco, que los obstáculos sean de diferentes colores, serán de cualquier color y se escogerá de forma aleatoria ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que el jugador sea un script sin animaciones
User prompt
El jugador rotalo 180 grados y los obstáculos que sean pelotas de play
User prompt
Que el personaje stik man este en orizontal, las plataformas deben ser azules como agua y el fondo debe ser como una piscina olímpica
User prompt
Que el jugador sea más grande al igual que su colisión
User prompt
El jugador debe de ser un personaje tipo stik man
User prompt
Los obstáculos aparecen un 46% más en la plataforma donde está el jugador
User prompt
Los obstáculos aparecen un 40% más frecuentemente
User prompt
Los obstáculos aparecen principalmente en la plataforma donde está el jugador. En vez de 3 plataformas habrá 2 y los obstáculos aumentarán su velocidad en 1 cada 100 puntos
User prompt
Los obstáculos tienen un 38% más posibilidades de aparecer en la plataforma en la que esté el jugador
User prompt
Vuelve a hacer desde 0 el codigo y apariencia del jugador
User prompt
El fondo es una puesta de sol
User prompt
Los obstáculos son picos que salen del piso, son como unos triángulo
User prompt
Los obstáculos son picos
User prompt
Make the camera closer to the player and the 3
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// New Player class with stick figure design
var Player = Container.expand(function () {
var self = Container.call(this);
// Create stick figure body (vertical line)
var bodyBase = self.attachAsset('stickBody', {
anchorX: 0.5,
anchorY: 0.5
});
// Create stick figure head (circle)
var head = self.attachAsset('stickHead', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -30
});
// Create stick figure arms
self.leftArm = self.attachAsset('stickArm', {
anchorX: 1,
anchorY: 0.5,
x: -2,
y: -10
});
self.rightArm = self.attachAsset('stickArm', {
anchorX: 0,
anchorY: 0.5,
x: 2,
y: -10
});
// Create stick figure legs for running animation
self.leftLeg = self.attachAsset('stickLeg', {
anchorX: 0.5,
anchorY: 0,
x: -3,
y: 20
});
self.rightLeg = self.attachAsset('stickLeg', {
anchorX: 0.5,
anchorY: 0,
x: 3,
y: 20
});
// Player properties
self.currentLane = 0; // 0=top, 1=bottom (only 2 lanes now)
self.isMoving = false;
self.targetY = 0;
self.moveSpeed = 18; // Faster movement
self.runAnimationTimer = 0;
self.jumpHeight = 0;
self.jumpVelocity = 0;
self.isJumping = false;
// Initialize lane positions array for cleaner code
self.lanePositions = [0, 0]; // Will be set when lanes are defined
// Move up to previous lane
self.moveUp = function () {
if (!self.isMoving && self.currentLane > 0) {
self.currentLane--;
self.isMoving = true;
self.isJumping = true;
self.jumpVelocity = -15; // Initial jump velocity
self.updateTargetPosition();
LK.getSound('platformSwitch').play();
}
};
// Move down to next lane
self.moveDown = function () {
if (!self.isMoving && self.currentLane < 1) {
self.currentLane++;
self.isMoving = true;
self.isJumping = true;
self.jumpVelocity = -15; // Initial jump velocity
self.updateTargetPosition();
LK.getSound('platformSwitch').play();
}
};
// Update target position based on current lane
self.updateTargetPosition = function () {
// Use global lane positions if available, otherwise use defaults
if (typeof topLaneY !== 'undefined') {
self.lanePositions[0] = topLaneY - 50;
self.lanePositions[1] = bottomLaneY - 50;
}
self.targetY = self.lanePositions[self.currentLane];
};
// Animate running motion
self.animateRun = function () {
self.runAnimationTimer++;
var cycle = self.runAnimationTimer % 20;
// Leg animation for stick figure
if (cycle < 10) {
self.leftLeg.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.5;
self.rightLeg.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.5;
} else {
self.leftLeg.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.5;
self.rightLeg.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.5;
}
// Arm animation for stick figure
self.leftArm.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.3;
self.rightArm.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.3;
// Slight body bounce
bodyBase.y = Math.sin(self.runAnimationTimer * 0.2) * 1;
head.y = -30 + Math.sin(self.runAnimationTimer * 0.2) * 2;
};
// Update function called every frame
self.update = function () {
// Always animate running
self.animateRun();
// Handle lane switching movement
if (self.isMoving) {
var diff = self.targetY - self.y;
// Vertical movement
if (Math.abs(diff) < self.moveSpeed) {
self.y = self.targetY;
self.isMoving = false;
} else {
self.y += diff > 0 ? self.moveSpeed : -self.moveSpeed;
}
// Jump animation during lane switch
if (self.isJumping) {
self.jumpVelocity += 1.5; // Gravity
self.jumpHeight += self.jumpVelocity;
// Apply jump height to visual elements
var jumpOffset = Math.min(0, self.jumpHeight);
bodyBase.y = jumpOffset + Math.sin(self.runAnimationTimer * 0.2) * 1;
head.y = -30 + jumpOffset + Math.sin(self.runAnimationTimer * 0.2) * 2;
self.leftLeg.y = 20 + jumpOffset;
self.rightLeg.y = 20 + jumpOffset;
self.leftArm.y = -10 + jumpOffset;
self.rightArm.y = -10 + jumpOffset;
// End jump when landing
if (self.jumpHeight >= 0 && self.jumpVelocity > 0) {
self.jumpHeight = 0;
self.jumpVelocity = 0;
self.isJumping = false;
}
}
}
};
return self;
});
var SpawnArrow = Container.expand(function (lane) {
var self = Container.call(this);
self.lane = lane || 'middle';
var arrowGraphics = self.attachAsset('spawnArrow', {
anchorX: 0.5,
anchorY: 0.5
});
arrowGraphics.rotation = Math.PI; // Point left toward incoming obstacles
self.fadeTimer = 0;
self.maxFadeTime = 60; // 1 second at 60fps
self.update = function () {
self.fadeTimer++;
var alpha = 1 - self.fadeTimer / self.maxFadeTime;
if (alpha <= 0) {
self.destroy();
return;
}
arrowGraphics.alpha = alpha;
};
return self;
});
var Spike = Container.expand(function (lane, size) {
var self = Container.call(this);
self.lane = lane || 'middle';
self.size = size || 'small';
self.speed = 8;
self.isLarge = size === 'large';
// Create triangular spike from ground
var baseAsset = size === 'large' ? 'spikeLargeBase' : 'spikeBase';
var pointAsset = size === 'large' ? 'spikeLargePoint' : 'spikePoint';
// Create base of spike (wider bottom part)
var spikeBase = self.attachAsset(baseAsset, {
anchorX: 0.5,
anchorY: 1.0
});
// Create pointed top of spike
var spikePoint = self.attachAsset(pointAsset, {
anchorX: 0.5,
anchorY: 1.0
});
// Position point on top of base to create triangle shape
spikePoint.y = -spikeBase.height;
self.update = function () {
self.x -= self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2F4F4F
});
/****
* Game Code
****/
// Game dimensions: 2048x2732
var Obstacle = Spike;
var gameWidth = 2048;
var gameHeight = 2732;
// Lane positions - now only 2 lanes
var topLaneY = gameHeight * 0.4;
var bottomLaneY = gameHeight * 0.6;
// Game variables
var player;
var obstacles = [];
var spawnArrows = [];
var pendingObstacles = [];
var gameSpeed = 1;
var spawnTimer = 0;
var spawnInterval = 120; // frames between spawns
var gameTime = 0; // tracks game time in frames (60fps = 1 second)
var speedIncreaseInterval = 600; // increase speed every 10 seconds at 60fps
var largeObstaclesSpawned = 0;
var lastScoreCheck = 0;
// Initialize score display
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create player
player = game.addChild(new Player());
player.x = gameWidth * 0.35; // Move player closer to center for better camera view
player.y = topLaneY - 50; // Position on top of platform with new player height
player.updateTargetPosition(); // Initialize target positions
// Create arrow buttons
var arrowUp = LK.getAsset('arrowUp', {
anchorX: 0.5,
anchorY: 0.5
});
arrowUp.x = gameWidth - 150;
arrowUp.y = gameHeight - 300;
LK.gui.addChild(arrowUp);
var arrowDown = LK.getAsset('arrowDown', {
anchorX: 0.5,
anchorY: 0.5
});
arrowDown.x = gameWidth - 150;
arrowDown.y = gameHeight - 150;
LK.gui.addChild(arrowDown);
// Arrow button event handlers
arrowUp.down = function (x, y, obj) {
player.moveUp();
};
arrowDown.down = function (x, y, obj) {
player.moveDown();
};
// Draw stone platform tracks with finer texture matching hitbox
// Create top platform using fine texture tiles
for (var i = 0; i < 41; i++) {
var topTile = LK.getAsset('platformFine', {
anchorX: 0,
anchorY: 0.5,
scaleX: 3,
scaleY: 7.2
});
topTile.x = i * 50;
topTile.y = topLaneY;
game.addChild(topTile);
}
// Create bottom platform using fine texture tiles
for (var i = 0; i < 41; i++) {
var bottomTile = LK.getAsset('platformFine', {
anchorX: 0,
anchorY: 0.5,
scaleX: 3,
scaleY: 7.2
});
bottomTile.x = i * 50;
bottomTile.y = bottomLaneY;
game.addChild(bottomTile);
}
function spawnObstacle() {
var lanes = ['top', 'bottom'];
var sizes = ['small', 'medium', 'large'];
var currentScore = LK.getScore();
var scoreSegment = Math.floor(currentScore / 150);
var requiredLargeObstacles = (scoreSegment + 1) * 3;
var forceLarge = false;
// Check if we need to force a large obstacle
if (scoreSegment > Math.floor(lastScoreCheck / 150)) {
// We've entered a new 150-point segment, reset counter
largeObstaclesSpawned = 0;
lastScoreCheck = currentScore;
}
// Force large obstacle if we haven't met the requirement and we're near the end of the segment
var progressInSegment = currentScore % 150;
if (progressInSegment > 100 && largeObstaclesSpawned < 3) {
forceLarge = true;
}
var randomSize;
if (forceLarge) {
randomSize = 'large';
} else {
randomSize = sizes[Math.floor(Math.random() * sizes.length)];
}
// Track large obstacles
if (randomSize === 'large') {
largeObstaclesSpawned++;
}
var randomLane;
// 46% more chance to spawn obstacle on player's current lane
// Base probability for 2 lanes is 50%, so 46% more = 73% for player's lane
if (Math.random() < 0.73) {
randomLane = lanes[player.currentLane];
} else {
// 27% chance for the other lane
randomLane = lanes[1 - player.currentLane];
}
// Create spawn arrow indicator
var spawnArrow = new SpawnArrow(randomLane);
spawnArrow.x = gameWidth - 250; // Position spawn arrow closer to match tighter view
if (randomLane === 'top') {
spawnArrow.y = topLaneY;
} else {
spawnArrow.y = bottomLaneY;
}
// Add pulsing animation to spawn arrow
tween(spawnArrow, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 250,
easing: tween.easeInOut
});
tween(spawnArrow, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 250,
easing: tween.easeInOut
});
spawnArrows.push(spawnArrow);
game.addChild(spawnArrow);
// Schedule obstacle to spawn after 0.5 seconds (30 frames at 60fps)
var pendingObstacle = {
lane: randomLane,
size: randomSize,
spawnTime: LK.ticks + 30
};
pendingObstacles.push(pendingObstacle);
}
function createObstacle(lane, size) {
var obstacle = new Spike(lane, size);
obstacle.x = gameWidth - 200; // Spawn obstacles closer to screen for tighter view
if (lane === 'top') {
obstacle.y = topLaneY - 40; // Position on top of platform
} else {
obstacle.y = bottomLaneY - 40; // Position on top of platform
}
var baseSpeed = 8;
var speedBonus = Math.floor(LK.getScore() / 100);
obstacle.speed = (baseSpeed + speedBonus) * gameSpeed;
obstacles.push(obstacle);
game.addChild(obstacle);
}
function checkCollisions() {
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
var collision = false;
// Check collision based on lane
if (obstacle.lane === 'top' && player.currentLane === 0 || obstacle.lane === 'bottom' && player.currentLane === 1) {
collision = player.intersects(obstacle);
}
if (collision) {
LK.getSound('collision').play();
LK.effects.flashScreen(0xFF0000, 1000);
LK.showGameOver();
return;
}
}
}
// Touch controls for platform switching
var touchStartY = 0;
game.down = function (x, y, obj) {
touchStartY = y;
};
game.up = function (x, y, obj) {
var swipeDistance = y - touchStartY;
if (Math.abs(swipeDistance) > 100) {
if (swipeDistance < 0) {
// Swipe up
player.moveUp();
} else {
// Swipe down
player.moveDown();
}
}
};
// Main game loop
game.update = function () {
// Update game time (1 second = 60 frames at 60fps)
gameTime++;
// Update score: 1 point every 0.5 seconds (30 frames)
var timeScore = Math.floor(gameTime / 30);
LK.setScore(timeScore);
scoreTxt.setText('Score: ' + LK.getScore());
// Increase obstacle speed by 1 for every 100 points
var baseSpeed = 8;
var speedBonus = Math.floor(LK.getScore() / 100);
var currentObstacleSpeed = baseSpeed + speedBonus;
// Increase game speed over time
if (LK.ticks % speedIncreaseInterval === 0) {
gameSpeed += 0.1;
if (spawnInterval > 60) {
spawnInterval -= 5;
}
}
// Spawn obstacles
spawnTimer++;
// Reduce spawn interval by 40% to increase frequency (multiply by 0.6)
var adjustedSpawnInterval = Math.floor(spawnInterval * 0.6);
if (spawnTimer >= adjustedSpawnInterval) {
spawnObstacle();
spawnTimer = 0;
}
// Check for pending obstacles to spawn
for (var i = pendingObstacles.length - 1; i >= 0; i--) {
var pending = pendingObstacles[i];
if (LK.ticks >= pending.spawnTime) {
createObstacle(pending.lane, pending.size);
pendingObstacles.splice(i, 1);
}
}
// Update obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
obstacle.speed = currentObstacleSpeed * gameSpeed;
// Remove obstacles that are off screen
if (obstacle.x < -100) {
obstacle.destroy();
obstacles.splice(i, 1);
}
}
// Update and clean up spawn arrows
for (var i = spawnArrows.length - 1; i >= 0; i--) {
var arrow = spawnArrows[i];
if (arrow.fadeTimer >= arrow.maxFadeTime) {
spawnArrows.splice(i, 1);
}
}
// Check for collisions
checkCollisions();
}; ===================================================================
--- original.js
+++ change.js
@@ -5,35 +5,48 @@
/****
* Classes
****/
-// New Player class with improved design and functionality
+// New Player class with stick figure design
var Player = Container.expand(function () {
var self = Container.call(this);
- // Create player body using shapes for better visual
- var bodyBase = self.attachAsset('playerBody', {
+ // Create stick figure body (vertical line)
+ var bodyBase = self.attachAsset('stickBody', {
anchorX: 0.5,
- anchorY: 0.8
+ anchorY: 0.5
});
- // Create player head
- var head = self.attachAsset('playerHead', {
+ // Create stick figure head (circle)
+ var head = self.attachAsset('stickHead', {
anchorX: 0.5,
- anchorY: 1.0,
+ anchorY: 0.5,
x: 0,
- y: -45
+ y: -30
});
- // Create player legs for running animation
- self.leftLeg = self.attachAsset('playerLeg', {
+ // Create stick figure arms
+ self.leftArm = self.attachAsset('stickArm', {
+ anchorX: 1,
+ anchorY: 0.5,
+ x: -2,
+ y: -10
+ });
+ self.rightArm = self.attachAsset('stickArm', {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: 2,
+ y: -10
+ });
+ // Create stick figure legs for running animation
+ self.leftLeg = self.attachAsset('stickLeg', {
anchorX: 0.5,
anchorY: 0,
- x: -15,
- y: 5
+ x: -3,
+ y: 20
});
- self.rightLeg = self.attachAsset('playerLeg', {
+ self.rightLeg = self.attachAsset('stickLeg', {
anchorX: 0.5,
anchorY: 0,
- x: 15,
- y: 5
+ x: 3,
+ y: 20
});
// Player properties
self.currentLane = 0; // 0=top, 1=bottom (only 2 lanes now)
self.isMoving = false;
@@ -79,19 +92,22 @@
// Animate running motion
self.animateRun = function () {
self.runAnimationTimer++;
var cycle = self.runAnimationTimer % 20;
- // Leg animation
+ // Leg animation for stick figure
if (cycle < 10) {
- self.leftLeg.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.4;
- self.rightLeg.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.4;
+ self.leftLeg.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.5;
+ self.rightLeg.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.5;
} else {
- self.leftLeg.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.4;
- self.rightLeg.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.4;
+ self.leftLeg.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.5;
+ self.rightLeg.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.5;
}
+ // Arm animation for stick figure
+ self.leftArm.rotation = -Math.sin(self.runAnimationTimer * 0.3) * 0.3;
+ self.rightArm.rotation = Math.sin(self.runAnimationTimer * 0.3) * 0.3;
// Slight body bounce
- bodyBase.y = Math.sin(self.runAnimationTimer * 0.2) * 2;
- head.y = -45 + Math.sin(self.runAnimationTimer * 0.2) * 3;
+ bodyBase.y = Math.sin(self.runAnimationTimer * 0.2) * 1;
+ head.y = -30 + Math.sin(self.runAnimationTimer * 0.2) * 2;
};
// Update function called every frame
self.update = function () {
// Always animate running
@@ -111,12 +127,14 @@
self.jumpVelocity += 1.5; // Gravity
self.jumpHeight += self.jumpVelocity;
// Apply jump height to visual elements
var jumpOffset = Math.min(0, self.jumpHeight);
- bodyBase.y = jumpOffset + Math.sin(self.runAnimationTimer * 0.2) * 2;
- head.y = -45 + jumpOffset + Math.sin(self.runAnimationTimer * 0.2) * 3;
- self.leftLeg.y = 5 + jumpOffset;
- self.rightLeg.y = 5 + jumpOffset;
+ bodyBase.y = jumpOffset + Math.sin(self.runAnimationTimer * 0.2) * 1;
+ head.y = -30 + jumpOffset + Math.sin(self.runAnimationTimer * 0.2) * 2;
+ self.leftLeg.y = 20 + jumpOffset;
+ self.rightLeg.y = 20 + jumpOffset;
+ self.leftArm.y = -10 + jumpOffset;
+ self.rightArm.y = -10 + jumpOffset;
// End jump when landing
if (self.jumpHeight >= 0 && self.jumpVelocity > 0) {
self.jumpHeight = 0;
self.jumpVelocity = 0;