User prompt
anΜadele musica hazlo un poco mas facil no tanto simp,lemente que si caminan a 10 que vayan a 8 los obstaculos y haz que el contador cada vez que cambia de numero se vuelva mas grande y vuelva a su size βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
ahora haz que haya un cuadrito azul que aparezca cada 10 scores y que te de 8 segs de velocidad x1.5 y que haya uno amarillo que aparezca cada 30 y que te de inmunidad por 13 segs βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que el fondo sea full black pero manten el scrolling bg con estrellitas y haz que el mouse se centre en el player que no lo puedas mover arriba o abajo y que sin hacer click lo puedes mover
User prompt
haz que haya background, que mientras mas score mas rapido el juego y mas dificil βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Dodge Drop - Extreme Survival Challenge
Initial prompt
Crea un juego de esquivar objetos donde hay un gameover y un score 1,2,3 etc y de arriba caen los obstaculos - que al juego sea muy dificil
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var graphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.lastY = undefined;
self.lastPlayerIntersecting = false;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var graphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Star = Container.expand(function () {
var self = Container.call(this);
var graphics = self.attachAsset('star', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2 + Math.random() * 3;
self.lastY = undefined;
graphics.alpha = 0.3 + Math.random() * 0.7;
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game variables
var obstacles = [];
var stars = [];
var player;
var scoreTimer = 0;
var spawnTimer = 0;
var spawnDelay = 60; // Start spawning every 60 ticks (1 second)
var difficultyTimer = 0;
var starSpawnTimer = 0;
var baseObstacleSpeed = 8;
var baseSpawnDelay = 60;
// Create score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create player
player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 200;
// Game update function
game.update = function () {
// Calculate difficulty multiplier based on score
var difficultyMultiplier = 1 + LK.getScore() * 0.1;
var speedMultiplier = 1 + LK.getScore() * 0.15;
// Update score every second (60 ticks)
scoreTimer++;
if (scoreTimer >= 60) {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
scoreTimer = 0;
}
// Spawn background stars
starSpawnTimer++;
if (starSpawnTimer >= Math.max(5, 15 - Math.floor(LK.getScore() / 5))) {
var star = new Star();
star.x = Math.random() * 2048;
star.y = -10;
star.lastY = star.y;
star.speed *= 1 + LK.getScore() * 0.05;
stars.push(star);
game.addChild(star);
starSpawnTimer = 0;
}
// Update stars
for (var s = stars.length - 1; s >= 0; s--) {
var star = stars[s];
if (star.lastY === undefined) star.lastY = star.y;
if (star.lastY <= 2732 + 20 && star.y > 2732 + 20) {
star.destroy();
stars.splice(s, 1);
continue;
}
star.lastY = star.y;
}
// Increase difficulty over time
difficultyTimer++;
if (difficultyTimer >= 180) {
// Every 3 seconds, make it progressively harder
spawnDelay = Math.max(15, baseSpawnDelay - Math.floor(LK.getScore() / 3) * 3);
difficultyTimer = 0;
}
// Spawn obstacles with progressive difficulty
spawnTimer++;
var currentSpawnDelay = Math.max(15, spawnDelay - Math.floor(difficultyMultiplier * 5));
if (spawnTimer >= currentSpawnDelay) {
var obstacle = new Obstacle();
obstacle.x = Math.random() * (2048 - 60) + 30;
obstacle.y = -30;
obstacle.lastY = obstacle.y;
// Dramatic speed increase based on score
obstacle.speed = (baseObstacleSpeed + Math.floor(LK.getScore() / 5) * 3) * speedMultiplier;
// More dramatic size variation
var sizeMultiplier = 0.8 + Math.random() * (0.7 + LK.getScore() * 0.05);
obstacle.scaleX = sizeMultiplier;
obstacle.scaleY = sizeMultiplier;
// Add tween effect for more dynamic obstacles
tween(obstacle, {
rotation: (Math.random() - 0.5) * Math.PI
}, {
duration: 1000 + Math.random() * 2000
});
obstacles.push(obstacle);
game.addChild(obstacle);
spawnTimer = 0;
}
// Update obstacles and check collisions
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
// Initialize lastY if undefined
if (obstacle.lastY === undefined) obstacle.lastY = obstacle.y;
// Check if obstacle went off screen
if (obstacle.lastY <= 2732 + 100 && obstacle.y > 2732 + 100) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Check collision with player
var currentIntersecting = obstacle.intersects(player);
if (!obstacle.lastPlayerIntersecting && currentIntersecting) {
// Game over on collision
LK.getSound('gameOver').play();
LK.effects.flashScreen(0xff0000, 500);
LK.showGameOver();
return;
}
// Update last states
obstacle.lastY = obstacle.y;
obstacle.lastPlayerIntersecting = currentIntersecting;
}
};
// Touch/drag controls
function handleMove(x, y, obj) {
// Always move player horizontally to follow mouse, regardless of drag state
player.x = Math.max(40, Math.min(2048 - 40, x)); // Keep player within bounds
player.y = 2732 - 200; // Keep player centered vertically at bottom
}
game.move = handleMove;
game.down = function (x, y, obj) {
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
// No drag logic needed anymore
}; ===================================================================
--- original.js
+++ change.js
@@ -46,9 +46,9 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x1a1a1a
+ backgroundColor: 0x000000
});
/****
* Game Code
@@ -61,9 +61,8 @@
var spawnTimer = 0;
var spawnDelay = 60; // Start spawning every 60 ticks (1 second)
var difficultyTimer = 0;
var starSpawnTimer = 0;
-var dragNode = null;
var baseObstacleSpeed = 8;
var baseSpawnDelay = 60;
// Create score display
var scoreTxt = new Text2('0', {
@@ -168,16 +167,15 @@
}
};
// Touch/drag controls
function handleMove(x, y, obj) {
- if (dragNode) {
- dragNode.x = Math.max(40, Math.min(2048 - 40, x)); // Keep player within bounds
- }
+ // Always move player horizontally to follow mouse, regardless of drag state
+ player.x = Math.max(40, Math.min(2048 - 40, x)); // Keep player within bounds
+ player.y = 2732 - 200; // Keep player centered vertically at bottom
}
game.move = handleMove;
game.down = function (x, y, obj) {
- dragNode = player;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
- dragNode = null;
+ // No drag logic needed anymore
};
\ No newline at end of file