User prompt
añ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;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Game variables
var obstacles = [];
var player;
var scoreTimer = 0;
var spawnTimer = 0;
var spawnDelay = 60; // Start spawning every 60 ticks (1 second)
var difficultyTimer = 0;
var dragNode = null;
// 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 () {
// Update score every second (60 ticks)
scoreTimer++;
if (scoreTimer >= 60) {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
scoreTimer = 0;
}
// Increase difficulty over time
difficultyTimer++;
if (difficultyTimer >= 300) {
// Every 5 seconds
spawnDelay = Math.max(20, spawnDelay - 2); // Faster spawning, minimum 20 ticks
difficultyTimer = 0;
}
// Spawn obstacles
spawnTimer++;
if (spawnTimer >= spawnDelay) {
var obstacle = new Obstacle();
obstacle.x = Math.random() * (2048 - 60) + 30; // Random x position
obstacle.y = -30;
obstacle.lastY = obstacle.y;
// Increase speed based on score
obstacle.speed = 8 + Math.floor(LK.getScore() / 10) * 2;
// Random size variation for increased difficulty
var sizeMultiplier = 1 + Math.random() * 0.5;
obstacle.scaleX = sizeMultiplier;
obstacle.scaleY = sizeMultiplier;
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) {
if (dragNode) {
dragNode.x = Math.max(40, Math.min(2048 - 40, x)); // Keep player within bounds
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = player;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,132 @@
-/****
+/****
+* 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;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x1a1a1a
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var obstacles = [];
+var player;
+var scoreTimer = 0;
+var spawnTimer = 0;
+var spawnDelay = 60; // Start spawning every 60 ticks (1 second)
+var difficultyTimer = 0;
+var dragNode = null;
+// 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 () {
+ // Update score every second (60 ticks)
+ scoreTimer++;
+ if (scoreTimer >= 60) {
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText(LK.getScore());
+ scoreTimer = 0;
+ }
+ // Increase difficulty over time
+ difficultyTimer++;
+ if (difficultyTimer >= 300) {
+ // Every 5 seconds
+ spawnDelay = Math.max(20, spawnDelay - 2); // Faster spawning, minimum 20 ticks
+ difficultyTimer = 0;
+ }
+ // Spawn obstacles
+ spawnTimer++;
+ if (spawnTimer >= spawnDelay) {
+ var obstacle = new Obstacle();
+ obstacle.x = Math.random() * (2048 - 60) + 30; // Random x position
+ obstacle.y = -30;
+ obstacle.lastY = obstacle.y;
+ // Increase speed based on score
+ obstacle.speed = 8 + Math.floor(LK.getScore() / 10) * 2;
+ // Random size variation for increased difficulty
+ var sizeMultiplier = 1 + Math.random() * 0.5;
+ obstacle.scaleX = sizeMultiplier;
+ obstacle.scaleY = sizeMultiplier;
+ 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) {
+ if (dragNode) {
+ dragNode.x = Math.max(40, Math.min(2048 - 40, x)); // Keep player within bounds
+ }
+}
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ dragNode = player;
+ handleMove(x, y, obj);
+};
+game.up = function (x, y, obj) {
+ dragNode = null;
+};
\ No newline at end of file