User prompt
Has que los obstaculos caigan un poco mas luego desde que el jugador se le acerque ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que el jugador toque el piso y que los obstaculos esten alejados entre si y que esten en una posicion aleatoria ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan un poco mas antes
User prompt
Has que los obstaculos caigan un poco mas antes
User prompt
Has que los obstaculos caigan un poco mas antes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan cuando el jugador estecsi por debajo de ellos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Un poco mas tarde ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Un poquito mas tarde ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan un poquito mas tarde ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan mucho antes de acercarse ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan mas rapido ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Quita la animacion de los objetos antes de caer ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan instantanea mente ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan mas rapido ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos caigan muy rapido y que vuelvan a caer al volver a acercarse ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos actuen como los don pisoton de mario bros ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que el jugador solo pueda ir al lado derecho
User prompt
Has que los obstaculos suban lentamente despues de bajar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que los obstaculos suban lentamente despues de bajar, que maten al jugador al tocarlo y que el nivel sea mas dificil ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que el jugador tenga que atravesar un solo nivel muy largo en donde los obstaculos se quedan estaticos en el aire hasta que el jugador pase cerca de ellos y bajen bruscamente y suban lentamente ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Has que al apretar el lado izquuerdo de la pantalla el jugador valla hacia la izquierda, y que al presionar el lado derecho el jugador valla a la derecha, y que el jugador no pueda saltar por lo que el nivel no tiene que tener obstaculos imposibles sin saltar
User prompt
Try again
User prompt
Has los botones mas grandes y que uno lleve al jugador al lado izquierdo, otro al derecho y uno para saltar
User prompt
Arregla los botones
User prompt
Has que la camara siga al jugador y que hallan botones para caminar y saltar
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 1.0
});
self.speed = 2;
self.direction = 1;
self.patrolDistance = 200;
self.startX = 0;
self.setPatrol = function (startX, distance) {
self.startX = startX;
self.patrolDistance = distance;
};
self.update = function () {
self.x += self.speed * self.direction;
if (self.x > self.startX + self.patrolDistance || self.x < self.startX) {
self.direction *= -1;
enemyGraphics.scaleX = self.direction;
}
};
return self;
});
var Goal = Container.expand(function () {
var self = Container.call(this);
var goalGraphics = self.attachAsset('goal', {
anchorX: 0.5,
anchorY: 1.0
});
// Animate goal with gentle pulsing
tween(goalGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(goalGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Restart animation
tween(goalGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 1000,
easing: tween.easeInOut
});
}
});
}
});
return self;
});
var Platform = Container.expand(function (width, height) {
var self = Container.call(this);
var platformGraphics = self.attachAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: width / 200,
scaleY: height / 40
});
self.width = width;
self.height = height;
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 8;
self.facing = 1; // 1 for right, -1 for left
self.moveLeft = function () {
self.velocityX = -self.speed;
self.facing = -1;
playerGraphics.scaleX = -1;
};
self.moveRight = function () {
self.velocityX = self.speed;
self.facing = 1;
playerGraphics.scaleX = 1;
};
self.stop = function () {
self.velocityX = 0;
};
self.update = function () {
// Apply velocity
self.x += self.velocityX;
// Check boundaries
if (self.x < 0) {
self.x = 0;
}
// Apply friction
self.velocityX *= 0.8;
};
return self;
});
var Spike = Container.expand(function () {
var self = Container.call(this);
var spikeGraphics = self.attachAsset('spike', {
anchorX: 0.5,
anchorY: 1.0
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var player;
var platforms = [];
var enemies = [];
var spikes = [];
var goal;
var gameStarted = false;
var levelStartTime = 0;
var currentLevel = 1;
var maxLevel = storage.maxLevel || 1;
// UI Elements
var levelText = new Text2('Level 1', {
size: 80,
fill: 0xFFFFFF
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
levelText.y = 50;
var instructionText = new Text2('Tap left side to move left, right side to move right', {
size: 60,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
LK.gui.center.addChild(instructionText);
function createLevel(levelNum) {
// Clear existing level
for (var i = platforms.length - 1; i >= 0; i--) {
platforms[i].destroy();
}
for (var i = enemies.length - 1; i >= 0; i--) {
enemies[i].destroy();
}
for (var i = spikes.length - 1; i >= 0; i--) {
spikes[i].destroy();
}
if (goal) {
goal.destroy();
}
platforms = [];
enemies = [];
spikes = [];
// Create one very long level
// Ground platform - very long continuous ground
var platform1 = game.addChild(new Platform(8000, 60));
platform1.x = 4000;
platform1.y = 2500;
platforms.push(platform1);
// Create floating obstacles that will fall when player approaches - more difficult level
var obstaclePositions = [400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 3600, 3800, 4000, 4200, 4400, 4600, 4800, 5000, 5200, 5400, 5600, 5800, 6000, 6200, 6400, 6600, 6800, 7000, 7200];
for (var i = 0; i < obstaclePositions.length; i++) {
var obstacle = game.addChild(new Platform(120, 80));
obstacle.x = obstaclePositions[i];
obstacle.y = 2200; // Start floating in air
obstacle.originalY = 2200;
obstacle.fallY = 2420; // Where it falls to (just above ground)
obstacle.isActive = false;
obstacle.triggerDistance = 150; // Reduced distance to make it more difficult
platforms.push(obstacle);
}
// Goal at the end
goal = game.addChild(new Goal());
goal.x = 7500;
goal.y = 2500;
}
function startGame() {
if (gameStarted) return;
gameStarted = true;
levelStartTime = Date.now();
instructionText.visible = false;
// Create player
player = game.addChild(new Player());
player.x = 200;
player.y = 2400;
// Create level
createLevel(currentLevel);
levelText.setText('The Long Journey');
}
function restartLevel() {
LK.getSound('hit').play();
LK.effects.flashScreen(0xFF0000, 500);
if (player) {
player.destroy();
}
// Reset player
player = game.addChild(new Player());
player.x = 200;
player.y = 2400;
levelStartTime = Date.now();
}
function nextLevel() {
// Game completed - single long level
LK.showYouWin();
}
// Touch controls
var leftPressed = false;
var rightPressed = false;
game.down = function (x, y, obj) {
if (!gameStarted) {
startGame();
return;
}
// Simple left/right screen tap detection
if (x < 2048 / 2) {
leftPressed = true;
} else {
rightPressed = true;
}
};
game.up = function (x, y, obj) {
leftPressed = false;
rightPressed = false;
if (player) {
player.stop();
}
};
game.update = function () {
if (!gameStarted || !player) return;
// Handle continuous movement
if (leftPressed && !rightPressed) {
player.moveLeft();
} else if (rightPressed && !leftPressed) {
player.moveRight();
} else if (!leftPressed && !rightPressed) {
player.stop();
}
// Check proximity to floating obstacles and trigger falling
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
// Skip the ground platform (first one)
if (i === 0) continue;
// Check if player is within trigger distance
var distanceToPlayer = Math.abs(player.x - platform.x);
// If player gets close and obstacle hasn't been activated yet
if (distanceToPlayer < platform.triggerDistance && !platform.isActive) {
platform.isActive = true;
// Stop any existing tweens on this platform
tween.stop(platform, {
y: true
});
// Fall quickly
tween(platform, {
y: platform.fallY
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
// After falling, wait a moment then rise slowly
LK.setTimeout(function () {
tween(platform, {
y: platform.originalY
}, {
duration: 4000,
// Slower rising - 4 seconds instead of 3
easing: tween.easeOut,
onFinish: function onFinish() {
// Reset the obstacle state so it can be triggered again
platform.isActive = false;
}
});
}, 1000); // Wait 1 second before starting to rise
}
});
}
}
// Check enemy collisions
for (var i = 0; i < enemies.length; i++) {
if (player.intersects(enemies[i])) {
restartLevel();
return;
}
}
// Check platform obstacle collisions (falling obstacles kill player)
for (var i = 1; i < platforms.length; i++) {
// Skip ground platform (index 0)
if (player.intersects(platforms[i])) {
restartLevel();
return;
}
}
// Check spike collisions
for (var i = 0; i < spikes.length; i++) {
if (player.intersects(spikes[i])) {
restartLevel();
return;
}
}
// Check goal collision
if (goal && player.intersects(goal)) {
LK.getSound('collect').play();
var completionTime = Math.floor((Date.now() - levelStartTime) / 1000);
LK.setScore(LK.getScore() + Math.max(100 - completionTime, 10));
nextLevel();
}
// Camera follow player with smooth interpolation
var targetX = -(player.x - 1024); // Center player on screen
var targetY = -(player.y - 1366); // Center player vertically
game.x += (targetX - game.x) * 0.1;
game.y += (targetY - game.y) * 0.1;
}; ===================================================================
--- original.js
+++ change.js
@@ -264,8 +264,12 @@
var distanceToPlayer = Math.abs(player.x - platform.x);
// If player gets close and obstacle hasn't been activated yet
if (distanceToPlayer < platform.triggerDistance && !platform.isActive) {
platform.isActive = true;
+ // Stop any existing tweens on this platform
+ tween.stop(platform, {
+ y: true
+ });
// Fall quickly
tween(platform, {
y: platform.fallY
}, {
@@ -276,15 +280,17 @@
LK.setTimeout(function () {
tween(platform, {
y: platform.originalY
}, {
- duration: 3000,
+ duration: 4000,
+ // Slower rising - 4 seconds instead of 3
easing: tween.easeOut,
onFinish: function onFinish() {
+ // Reset the obstacle state so it can be triggered again
platform.isActive = false;
}
});
- }, 500);
+ }, 1000); // Wait 1 second before starting to rise
}
});
}
}