User prompt
Bueno ahora quiero que la generación de los bates que se generan por la roca sea de cada 7 segundos, y que ahora cuando aparezca la roca, toda las demás spawneos de objetos se detenga, para que solo esté la generación de la roca y de los bates que genera la roca ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Quiero que la piedra aguante ahora 50 disparos, y que spawne en medio de la pantalla, y que que se mueva de lado a lado y ya no avance hacia adelante, y que ahora por cada 3 segundos que está la roca aparezcan 10 bates cubriendo todo el escenario de lado a lado ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ahora quiero que cuando se cumpla la condición cada 5 veces, aparezca una piedra que aguante 10 golpes, y que esa piedra de 50 puntos
User prompt
Ahora quiero que cuando los objetos sean destruidos haga una mínima explosión ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Buenísimo, solo que ahora necesito que el cuchillo y el palo aguanten 1 disparo, el bate 2 disparos y la espada 4 disparos
User prompt
Bien ahora quiero qie los objetos tengan más resistencia, que el bate aguante 5 disparos, el palo 3 disparos el cuchillo 3 disparos, y las espada 7 disparos
User prompt
Lo siento, pero necesito que vuelvas a poner el tiempo a 15 segundos
User prompt
A si me falto decir, si se cumple con la condición antes de que se acabe el tiempo se vuelve a resetear la condición, a si y que el tiempo ahora sea de 10 segundos
User prompt
Ahora tambien necesito que haya un temporizador en el qie necesites destruir 5 objetos en 15 segundos, y si no cumples con el tiempo te quitan 20 puntos, si se tienen menos de 20 puntos, y se acaba ese tiempo y no cumples con las condiciones tambien se pierde
User prompt
Ahora necesito que la velocidad de los objetos aumente al doble
User prompt
Ahora necesito que la velocidad del player sea menor
User prompt
Ok gracias, ahora solo necesito que la generación sea más rápida, y sea aleatoriamente, y que el player no pueda disparar tanto, que el límite sean 3 disparos por pantalla, después de que los disparos salgan se podrá volver a disparar
Code edit (1 edits merged)
Please save this source code
User prompt
Dodge & Destroy
Initial prompt
Hola, necesito un juego en el que hayan varios objeto que necesites esquivar, como cuchillos, espadas, bates de béisbol, palos y otros, en donde el player o jugador o protagonista necesite esquivarlo, pero que también pueda destruirlos disparandoles, y por cada objeto que destruya el player disparandole, gane un punto por cada objeto destruido, y el jugador o player solo aguante 3 golpes de esos objetos
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -15;
self.update = function () {
self.y += self.speed;
};
return self;
});
var FallingObject = Container.expand(function (type) {
var self = Container.call(this);
var objectGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = (Math.random() * 3 + 2) * 2;
self.type = type;
self.update = function () {
self.y += self.speed;
self.rotation += 0.05;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 4;
self.shootCooldown = 0;
self.update = function () {
if (self.shootCooldown > 0) {
self.shootCooldown--;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 200;
var bullets = [];
var fallingObjects = [];
var lives = 3;
var objectTypes = ['knife', 'sword', 'bat', 'stick'];
var spawnTimer = 0;
var spawnRate = 60;
var difficultyTimer = 0;
var maxBullets = 3;
// Timer challenge variables
var challengeTimer = 0;
var challengeDuration = 900; // 15 seconds at 60 FPS
var objectsDestroyed = 0;
var challengeTarget = 5;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
scoreText.x = 150;
scoreText.y = 50;
LK.gui.topLeft.addChild(scoreText);
var livesText = new Text2('Lives: 3', {
size: 60,
fill: 0xFF4444
});
livesText.anchor.set(1, 0);
LK.gui.topRight.addChild(livesText);
var timerText = new Text2('Time: 15s | Target: 5', {
size: 50,
fill: 0xFFFF00
});
timerText.anchor.set(0.5, 0);
timerText.x = 0;
timerText.y = 50;
LK.gui.top.addChild(timerText);
var dragActive = false;
var lastTouchX = 0;
var lastTouchY = 0;
function updateScore() {
scoreText.setText('Score: ' + LK.getScore());
}
function updateLives() {
livesText.setText('Lives: ' + lives);
}
function updateTimer() {
var timeLeft = Math.ceil((challengeDuration - challengeTimer) / 60);
var remaining = Math.max(0, challengeTarget - objectsDestroyed);
timerText.setText('Time: ' + timeLeft + 's | Need: ' + remaining);
}
function spawnFallingObject() {
var type = objectTypes[Math.floor(Math.random() * objectTypes.length)];
var obj = new FallingObject(type);
obj.x = Math.random() * (2048 - 100) + 50;
obj.y = -50;
fallingObjects.push(obj);
game.addChild(obj);
}
function shootBullet() {
if (player.shootCooldown <= 0 && bullets.length < maxBullets) {
var bullet = new Bullet();
bullet.x = player.x;
bullet.y = player.y - 40;
bullets.push(bullet);
game.addChild(bullet);
player.shootCooldown = 15;
LK.getSound('shoot').play();
}
}
function handleChallengeEnd() {
if (objectsDestroyed >= challengeTarget) {
// Challenge completed successfully
challengeTimer = 0;
objectsDestroyed = 0;
} else {
// Challenge failed - apply penalty
var currentScore = LK.getScore();
if (currentScore < 20) {
// Game over if score would go below 0
LK.showGameOver();
return;
} else {
// Subtract 20 points
LK.setScore(currentScore - 20);
updateScore();
challengeTimer = 0;
objectsDestroyed = 0;
}
}
updateTimer();
}
game.down = function (x, y, obj) {
dragActive = true;
lastTouchX = x;
lastTouchY = y;
shootBullet();
};
game.move = function (x, y, obj) {
if (dragActive) {
var deltaX = x - lastTouchX;
var deltaY = y - lastTouchY;
player.x += deltaX;
player.y += deltaY;
// Keep player within screen bounds
if (player.x < 40) player.x = 40;
if (player.x > 2048 - 40) player.x = 2048 - 40;
if (player.y < 40) player.y = 40;
if (player.y > 2732 - 40) player.y = 2732 - 40;
lastTouchX = x;
lastTouchY = y;
}
};
game.up = function (x, y, obj) {
dragActive = false;
};
game.update = function () {
// Increase difficulty over time
difficultyTimer++;
if (difficultyTimer % 400 === 0 && spawnRate > 20) {
spawnRate -= 3;
}
// Spawn falling objects with random timing
spawnTimer++;
var randomSpawnDelay = spawnRate + Math.floor(Math.random() * 30) - 15;
if (spawnTimer >= randomSpawnDelay) {
spawnFallingObject();
spawnTimer = 0;
}
// Update bullets
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
if (bullet.lastY === undefined) bullet.lastY = bullet.y;
// Remove bullets that go off screen
if (bullet.lastY >= -50 && bullet.y < -50) {
bullet.destroy();
bullets.splice(i, 1);
continue;
}
// Check bullet collision with falling objects
for (var j = fallingObjects.length - 1; j >= 0; j--) {
var obj = fallingObjects[j];
if (bullet.intersects(obj)) {
// Destroy both bullet and object
LK.setScore(LK.getScore() + 1);
objectsDestroyed++;
updateScore();
updateTimer();
LK.getSound('destroy').play();
// Check if challenge is completed
if (objectsDestroyed >= challengeTarget) {
challengeTimer = 0;
objectsDestroyed = 0;
updateTimer();
}
bullet.destroy();
bullets.splice(i, 1);
obj.destroy();
fallingObjects.splice(j, 1);
break;
}
}
if (bullets[i]) {
bullet.lastY = bullet.y;
}
}
// Update falling objects
for (var k = fallingObjects.length - 1; k >= 0; k--) {
var fallingObj = fallingObjects[k];
if (fallingObj.lastY === undefined) fallingObj.lastY = fallingObj.y;
// Remove objects that fall off screen
if (fallingObj.lastY <= 2732 + 50 && fallingObj.y > 2732 + 50) {
fallingObj.destroy();
fallingObjects.splice(k, 1);
continue;
}
// Check collision with player
if (fallingObj.intersects(player)) {
lives--;
updateLives();
LK.getSound('hit').play();
// Flash player red
tween(player, {
tint: 0xff0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(player, {
tint: 0xffffff
}, {
duration: 200
});
}
});
fallingObj.destroy();
fallingObjects.splice(k, 1);
if (lives <= 0) {
LK.showGameOver();
return;
}
continue;
}
fallingObj.lastY = fallingObj.y;
}
// Update challenge timer
challengeTimer++;
updateTimer();
if (challengeTimer >= challengeDuration) {
handleChallengeEnd();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -70,9 +70,9 @@
var difficultyTimer = 0;
var maxBullets = 3;
// Timer challenge variables
var challengeTimer = 0;
-var challengeDuration = 600; // 10 seconds at 60 FPS
+var challengeDuration = 900; // 15 seconds at 60 FPS
var objectsDestroyed = 0;
var challengeTarget = 5;
// UI Elements
var scoreText = new Text2('Score: 0', {
@@ -88,9 +88,9 @@
fill: 0xFF4444
});
livesText.anchor.set(1, 0);
LK.gui.topRight.addChild(livesText);
-var timerText = new Text2('Time: 10s | Target: 5', {
+var timerText = new Text2('Time: 15s | Target: 5', {
size: 50,
fill: 0xFFFF00
});
timerText.anchor.set(0.5, 0);
Quiero qie sea como un bate de béisbol de color cafe, en estilo 32 bits. In-Game asset. 2d. High contrast. No shadows
Quiero un cuchillo de color metal en estilo 32 bits. In-Game asset. 2d. High contrast. No shadows
Quiero una roca de color gris, circular, en estilo 32 bits. In-Game asset. 2d. High contrast. No shadows
Quiero un palo o rama de color cafe, en estilo 32 bits. In-Game asset. 2d. High contrast. No shadows
Quiero una espada de metal, estilo 32 bits. In-Game asset. 2d. High contrast. No shadows
Quiero una manzana roja, en estilo 32 bits. In-Game asset. 2d. High contrast. No shadows
Quiero un arbusto visto desde abajo, en 32 bits. In-Game asset. 2d. High contrast. No shadows
Una luz fuerte de color amarillo, en 32 bits. In-Game asset. 2d. High contrast. No shadows
Un coco, visto desde arriba, en 32 bits. In-Game asset. 2d. High contrast. No shadows