User prompt
Que la pantalla sea más grande para ver bien todo que la barra de tp es de color amarilla y está de costado en el menú no aparece nada más que la pared de piedra la puerta de piedra y la opción de inicio de juego al inicial el juego hay 3 opciones iniciar con 50 de vida con 100 de vida o con 120 de vida la vida de Kris es de color azul y aparece abajo del cuadrodo de combate y al lado de la barra de vida de kris aparece su cabeza junto con su nombre ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que en el fondo del menu sea una pared de Piedra con una puerta y con una musica misteriosa y con una risa de un dinosaurio en el fondo. Que en fondo del cuadródo de batalla este atrás de todos los objetos y que se puedan ver de manera demasiado bien ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
El corazón se puede ver bien en el cuadrado de combate. Dos que el rayo Lazer aparecerá en vez el cuando durante en turno del enemigo y tres cuando el jugador pasa cerca de un ataque subiría un 1% el tp y apareceria una silueta de corazon y sonaria un sonido ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
El cuadrado de batalla es negro y tienen unos bordes verdes ahora exisirera una opcion que dice defenderse que al utilizarla harán que Kris resiva menos daño y gane tp 15 ahora a un lado de la pantalla abra una barra de tp que subira llegando hasta 100 además en actúar abra una opción que requiere 25 de tp para dar un baile lindo para tranquilízar al enemigo subiendo unos 20%. Además en la opción de objetos se tengrian unos objetos 5 objetos llamados hamburguesa que curan un 25% de la vida una Lancer cookie que cura un 1% de la vida un pastel que cura toda la vida del personaje abría un objeto llamado esencia alma que aumenta un 35% el tp un objeto llamado ropa de la suerte que aumenta un 10% de la cantidad de tp que se gana en un turno y un hotdog congelado que cura un 5% de la vida el orden de los objetos es aletorio ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que se muestren números cada vez que el enemigo o el jugador resiven daño los números cuando el jugador hace daño son de color azul los números cuando el enemigo hace daño son de color rojo y los números cuando el jugador se cura o el enemigo o el enemigo se cura es de un color verde. En el botón de actuar apareceran unas opciones dos una que dice descripción y la otra que dice intentar calmar si se presiona descripción dirá dinosar ataque 10 defensa 5 vida 8500 es un dinosaurio que busca que ya no lo utilizen como arma si se presiona en botón de intentar calmar aparecerá un 10% de color amarillo y un diálogo que dice Kris intento calmar a dinosar no logro mucho pero dinosar se tranquilizo un poco y pareciera una barra de perdón que que se allenara un 10% cada vez que se utiliza esa opción cuando la barra sube al 100% unas pequeñas palabras apareceran abajo del botón de perdonar diciendo ya se puede perdonar y el botón de perdonar se podra amarillo en vez el cuando ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que la caja tenga izquinas de color verde. Que al inicial el juego allá una pantalla de menu. Abrían 5 ataques uno de espadas cayendo pero antes parpadearian de color rojo el segundo sería un habizo en una zona aletoria y luego una explosión el tercero sería balas de color blanco que aparecerían el varias partes y en quinto sería una bola gigante cayendo y rebotando el enemigo tengria 8500 de vida y el jugador hace 25 de daño ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fondo es negro con rayas azules que aparecen abría música durante la batalla la pantalla sería más grande el corazón aparecería del pecho de Kris e iría al cuadrado Kris reaccionaria cuando utiliza objetos o utiliza la opción de luchar ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Deltarune Chapter ???
Initial prompt
Hola puedes crear un rpg estilo batalla de deltarune. Abrían dos turnos en turno del jugador y el turno del enemigo abrían dos personajes Kris y el monstruo Kris estaría a un lado y el monstruo al otro el jugador es dos personaje Kris y un corazón Kris no se mueve y solo reacciona a varias cosas mientras que el corazón se mueve en el turno del enemigo el juego se llamará deltarune capitulo ???
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var ActionButton = Container.expand(function (text, action) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('actionButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 24,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.action = action;
self.down = function (x, y, obj) {
if (self.action) {
self.action();
}
};
return self;
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = 0;
self.speedY = 0;
self.lastX = 0;
self.lastY = 0;
self.update = function () {
self.lastX = self.x;
self.lastY = self.y;
self.x += self.speedX;
self.y += self.speedY;
};
return self;
});
var Character = Container.expand(function () {
var self = Container.call(this);
var characterGraphics = self.attachAsset('kris', {
anchorX: 0.5,
anchorY: 1.0
});
self.maxHP = 100;
self.currentHP = 100;
self.takeDamage = function (amount) {
self.currentHP = Math.max(0, self.currentHP - amount);
LK.effects.flashObject(characterGraphics, 0xff0000, 500);
LK.getSound('hit').play();
};
return self;
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
heartGraphics.rotation = Math.PI / 4; // Diamond shape
return self;
});
var Monster = Container.expand(function () {
var self = Container.call(this);
var monsterGraphics = self.attachAsset('monster', {
anchorX: 0.5,
anchorY: 1.0
});
self.maxHP = 80;
self.currentHP = 80;
self.takeDamage = function (amount) {
self.currentHP = Math.max(0, self.currentHP - amount);
LK.effects.flashObject(monsterGraphics, 0xff0000, 500);
LK.getSound('hit').play();
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
// Game state
var gameState = 'playerTurn'; // 'playerTurn', 'enemyTurn', 'gameOver'
var turnTimer = 0;
var attackTimer = 0;
var bullets = [];
var dragHeart = false;
// Characters
var kris = game.addChild(new Character());
kris.x = 400;
kris.y = 2000;
var monster = game.addChild(new Monster());
monster.x = 1650;
monster.y = 2000;
var heart = game.addChild(new Heart());
heart.x = 1024;
heart.y = 1800;
// Battle box
var battleBox = game.addChild(LK.getAsset('battleBox', {
anchorX: 0.5,
anchorY: 0.5
}));
battleBox.x = 1024;
battleBox.y = 1600;
battleBox.alpha = 0;
// Health bars
var krisHealthBg = game.addChild(LK.getAsset('healthBarBg', {
anchorX: 0,
anchorY: 0
}));
krisHealthBg.x = 200;
krisHealthBg.y = 200;
var krisHealthBar = game.addChild(LK.getAsset('healthBar', {
anchorX: 0,
anchorY: 0
}));
krisHealthBar.x = 202;
krisHealthBar.y = 202;
var monsterHealthBg = game.addChild(LK.getAsset('healthBarBg', {
anchorX: 0,
anchorY: 0
}));
monsterHealthBg.x = 1640;
monsterHealthBg.y = 200;
var monsterHealthBar = game.addChild(LK.getAsset('healthBar', {
anchorX: 0,
anchorY: 0
}));
monsterHealthBar.x = 1642;
monsterHealthBar.y = 202;
// Action buttons
var attackButton = game.addChild(new ActionButton('ATTACK', function () {
if (gameState === 'playerTurn') {
performAttack();
}
}));
attackButton.x = 400;
attackButton.y = 2400;
var actButton = game.addChild(new ActionButton('ACT', function () {
if (gameState === 'playerTurn') {
performAct();
}
}));
actButton.x = 700;
actButton.y = 2400;
var itemButton = game.addChild(new ActionButton('ITEM', function () {
if (gameState === 'playerTurn') {
performItem();
}
}));
itemButton.x = 1000;
itemButton.y = 2400;
var mercyButton = game.addChild(new ActionButton('MERCY', function () {
if (gameState === 'playerTurn') {
performMercy();
}
}));
mercyButton.x = 1300;
mercyButton.y = 2400;
// UI Text
var turnText = new Text2('Your Turn', {
size: 36,
fill: 0xFFFFFF
});
turnText.anchor.set(0.5, 0);
LK.gui.top.addChild(turnText);
var krisHPText = new Text2('KRIS HP: 100/100', {
size: 24,
fill: 0xFFFFFF
});
krisHPText.anchor.set(0, 0);
krisHPText.x = 200;
krisHPText.y = 240;
game.addChild(krisHPText);
var monsterHPText = new Text2('MONSTER HP: 80/80', {
size: 24,
fill: 0xFFFFFF
});
monsterHPText.anchor.set(1, 0);
monsterHPText.x = 1850;
monsterHPText.y = 240;
game.addChild(monsterHPText);
// Game functions
function performAttack() {
var damage = Math.floor(Math.random() * 20) + 15;
monster.takeDamage(damage);
LK.getSound('attack').play();
if (monster.currentHP <= 0) {
gameState = 'gameOver';
turnText.setText('Victory!');
LK.showYouWin();
return;
}
switchToEnemyTurn();
}
function performAct() {
// Simple act - just skip turn
switchToEnemyTurn();
}
function performItem() {
// Simple item use - heal
var healAmount = Math.floor(Math.random() * 15) + 10;
kris.currentHP = Math.min(kris.maxHP, kris.currentHP + healAmount);
switchToEnemyTurn();
}
function performMercy() {
if (monster.currentHP <= 20) {
gameState = 'gameOver';
turnText.setText('You spared the monster!');
LK.showYouWin();
} else {
switchToEnemyTurn();
}
}
function switchToEnemyTurn() {
gameState = 'enemyTurn';
turnText.setText('Enemy Turn - Dodge!');
turnTimer = 0;
attackTimer = 0;
// Show battle box
battleBox.alpha = 0.8;
// Move heart to battle box center
heart.x = battleBox.x;
heart.y = battleBox.y;
}
function switchToPlayerTurn() {
gameState = 'playerTurn';
turnText.setText('Your Turn');
// Hide battle box
battleBox.alpha = 0;
// Clear bullets
for (var i = bullets.length - 1; i >= 0; i--) {
bullets[i].destroy();
bullets.splice(i, 1);
}
// Move heart back to default position
heart.x = 1024;
heart.y = 1800;
}
function spawnBullet() {
var bullet = new Bullet();
// Spawn from random position around battle box
var side = Math.floor(Math.random() * 4);
var boxLeft = battleBox.x - 300;
var boxRight = battleBox.x + 300;
var boxTop = battleBox.y - 200;
var boxBottom = battleBox.y + 200;
switch (side) {
case 0:
// Top
bullet.x = boxLeft + Math.random() * 600;
bullet.y = boxTop - 50;
bullet.speedX = (Math.random() - 0.5) * 2;
bullet.speedY = 3 + Math.random() * 2;
break;
case 1:
// Right
bullet.x = boxRight + 50;
bullet.y = boxTop + Math.random() * 400;
bullet.speedX = -3 - Math.random() * 2;
bullet.speedY = (Math.random() - 0.5) * 2;
break;
case 2:
// Bottom
bullet.x = boxLeft + Math.random() * 600;
bullet.y = boxBottom + 50;
bullet.speedX = (Math.random() - 0.5) * 2;
bullet.speedY = -3 - Math.random() * 2;
break;
case 3:
// Left
bullet.x = boxLeft - 50;
bullet.y = boxTop + Math.random() * 400;
bullet.speedX = 3 + Math.random() * 2;
bullet.speedY = (Math.random() - 0.5) * 2;
break;
}
bullets.push(bullet);
game.addChild(bullet);
}
function updateHealthBars() {
// Update Kris health bar
var krisHealthRatio = kris.currentHP / kris.maxHP;
krisHealthBar.width = 200 * krisHealthRatio;
krisHPText.setText('KRIS HP: ' + kris.currentHP + '/' + kris.maxHP);
// Update monster health bar
var monsterHealthRatio = monster.currentHP / monster.maxHP;
monsterHealthBar.width = 200 * monsterHealthRatio;
monsterHPText.setText('MONSTER HP: ' + monster.currentHP + '/' + monster.maxHP);
}
// Heart movement
game.move = function (x, y, obj) {
if (gameState === 'enemyTurn' && dragHeart) {
// Constrain heart to battle box
var boxLeft = battleBox.x - 285;
var boxRight = battleBox.x + 285;
var boxTop = battleBox.y - 185;
var boxBottom = battleBox.y + 185;
heart.x = Math.max(boxLeft, Math.min(boxRight, x));
heart.y = Math.max(boxTop, Math.min(boxBottom, y));
}
};
game.down = function (x, y, obj) {
if (gameState === 'enemyTurn') {
dragHeart = true;
heart.x = Math.max(battleBox.x - 285, Math.min(battleBox.x + 285, x));
heart.y = Math.max(battleBox.y - 185, Math.min(battleBox.y + 185, y));
}
};
game.up = function (x, y, obj) {
dragHeart = false;
};
game.update = function () {
updateHealthBars();
if (gameState === 'enemyTurn') {
turnTimer++;
attackTimer++;
// Spawn bullets periodically
if (attackTimer % 45 === 0) {
spawnBullet();
}
// Update bullets
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
// Check if bullet is off screen
if (bullet.x < -100 || bullet.x > 2148 || bullet.y < -100 || bullet.y > 2832) {
bullet.destroy();
bullets.splice(i, 1);
continue;
}
// Check collision with heart
if (bullet.intersects(heart)) {
kris.takeDamage(10);
bullet.destroy();
bullets.splice(i, 1);
if (kris.currentHP <= 0) {
gameState = 'gameOver';
turnText.setText('Game Over');
LK.showGameOver();
return;
}
continue;
}
}
// End enemy turn after 5 seconds
if (turnTimer >= 300) {
switchToPlayerTurn();
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,365 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var ActionButton = Container.expand(function (text, action) {
+ var self = Container.call(this);
+ var buttonGraphics = self.attachAsset('actionButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var buttonText = new Text2(text, {
+ size: 24,
+ fill: 0xFFFFFF
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.action = action;
+ self.down = function (x, y, obj) {
+ if (self.action) {
+ self.action();
+ }
+ };
+ return self;
+});
+var Bullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speedX = 0;
+ self.speedY = 0;
+ self.lastX = 0;
+ self.lastY = 0;
+ self.update = function () {
+ self.lastX = self.x;
+ self.lastY = self.y;
+ self.x += self.speedX;
+ self.y += self.speedY;
+ };
+ return self;
+});
+var Character = Container.expand(function () {
+ var self = Container.call(this);
+ var characterGraphics = self.attachAsset('kris', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.maxHP = 100;
+ self.currentHP = 100;
+ self.takeDamage = function (amount) {
+ self.currentHP = Math.max(0, self.currentHP - amount);
+ LK.effects.flashObject(characterGraphics, 0xff0000, 500);
+ LK.getSound('hit').play();
+ };
+ return self;
+});
+var Heart = Container.expand(function () {
+ var self = Container.call(this);
+ var heartGraphics = self.attachAsset('heart', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ heartGraphics.rotation = Math.PI / 4; // Diamond shape
+ return self;
+});
+var Monster = Container.expand(function () {
+ var self = Container.call(this);
+ var monsterGraphics = self.attachAsset('monster', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.maxHP = 80;
+ self.currentHP = 80;
+ self.takeDamage = function (amount) {
+ self.currentHP = Math.max(0, self.currentHP - amount);
+ LK.effects.flashObject(monsterGraphics, 0xff0000, 500);
+ LK.getSound('hit').play();
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x1a1a2e
+});
+
+/****
+* Game Code
+****/
+// Game state
+var gameState = 'playerTurn'; // 'playerTurn', 'enemyTurn', 'gameOver'
+var turnTimer = 0;
+var attackTimer = 0;
+var bullets = [];
+var dragHeart = false;
+// Characters
+var kris = game.addChild(new Character());
+kris.x = 400;
+kris.y = 2000;
+var monster = game.addChild(new Monster());
+monster.x = 1650;
+monster.y = 2000;
+var heart = game.addChild(new Heart());
+heart.x = 1024;
+heart.y = 1800;
+// Battle box
+var battleBox = game.addChild(LK.getAsset('battleBox', {
+ anchorX: 0.5,
+ anchorY: 0.5
+}));
+battleBox.x = 1024;
+battleBox.y = 1600;
+battleBox.alpha = 0;
+// Health bars
+var krisHealthBg = game.addChild(LK.getAsset('healthBarBg', {
+ anchorX: 0,
+ anchorY: 0
+}));
+krisHealthBg.x = 200;
+krisHealthBg.y = 200;
+var krisHealthBar = game.addChild(LK.getAsset('healthBar', {
+ anchorX: 0,
+ anchorY: 0
+}));
+krisHealthBar.x = 202;
+krisHealthBar.y = 202;
+var monsterHealthBg = game.addChild(LK.getAsset('healthBarBg', {
+ anchorX: 0,
+ anchorY: 0
+}));
+monsterHealthBg.x = 1640;
+monsterHealthBg.y = 200;
+var monsterHealthBar = game.addChild(LK.getAsset('healthBar', {
+ anchorX: 0,
+ anchorY: 0
+}));
+monsterHealthBar.x = 1642;
+monsterHealthBar.y = 202;
+// Action buttons
+var attackButton = game.addChild(new ActionButton('ATTACK', function () {
+ if (gameState === 'playerTurn') {
+ performAttack();
+ }
+}));
+attackButton.x = 400;
+attackButton.y = 2400;
+var actButton = game.addChild(new ActionButton('ACT', function () {
+ if (gameState === 'playerTurn') {
+ performAct();
+ }
+}));
+actButton.x = 700;
+actButton.y = 2400;
+var itemButton = game.addChild(new ActionButton('ITEM', function () {
+ if (gameState === 'playerTurn') {
+ performItem();
+ }
+}));
+itemButton.x = 1000;
+itemButton.y = 2400;
+var mercyButton = game.addChild(new ActionButton('MERCY', function () {
+ if (gameState === 'playerTurn') {
+ performMercy();
+ }
+}));
+mercyButton.x = 1300;
+mercyButton.y = 2400;
+// UI Text
+var turnText = new Text2('Your Turn', {
+ size: 36,
+ fill: 0xFFFFFF
+});
+turnText.anchor.set(0.5, 0);
+LK.gui.top.addChild(turnText);
+var krisHPText = new Text2('KRIS HP: 100/100', {
+ size: 24,
+ fill: 0xFFFFFF
+});
+krisHPText.anchor.set(0, 0);
+krisHPText.x = 200;
+krisHPText.y = 240;
+game.addChild(krisHPText);
+var monsterHPText = new Text2('MONSTER HP: 80/80', {
+ size: 24,
+ fill: 0xFFFFFF
+});
+monsterHPText.anchor.set(1, 0);
+monsterHPText.x = 1850;
+monsterHPText.y = 240;
+game.addChild(monsterHPText);
+// Game functions
+function performAttack() {
+ var damage = Math.floor(Math.random() * 20) + 15;
+ monster.takeDamage(damage);
+ LK.getSound('attack').play();
+ if (monster.currentHP <= 0) {
+ gameState = 'gameOver';
+ turnText.setText('Victory!');
+ LK.showYouWin();
+ return;
+ }
+ switchToEnemyTurn();
+}
+function performAct() {
+ // Simple act - just skip turn
+ switchToEnemyTurn();
+}
+function performItem() {
+ // Simple item use - heal
+ var healAmount = Math.floor(Math.random() * 15) + 10;
+ kris.currentHP = Math.min(kris.maxHP, kris.currentHP + healAmount);
+ switchToEnemyTurn();
+}
+function performMercy() {
+ if (monster.currentHP <= 20) {
+ gameState = 'gameOver';
+ turnText.setText('You spared the monster!');
+ LK.showYouWin();
+ } else {
+ switchToEnemyTurn();
+ }
+}
+function switchToEnemyTurn() {
+ gameState = 'enemyTurn';
+ turnText.setText('Enemy Turn - Dodge!');
+ turnTimer = 0;
+ attackTimer = 0;
+ // Show battle box
+ battleBox.alpha = 0.8;
+ // Move heart to battle box center
+ heart.x = battleBox.x;
+ heart.y = battleBox.y;
+}
+function switchToPlayerTurn() {
+ gameState = 'playerTurn';
+ turnText.setText('Your Turn');
+ // Hide battle box
+ battleBox.alpha = 0;
+ // Clear bullets
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ bullets[i].destroy();
+ bullets.splice(i, 1);
+ }
+ // Move heart back to default position
+ heart.x = 1024;
+ heart.y = 1800;
+}
+function spawnBullet() {
+ var bullet = new Bullet();
+ // Spawn from random position around battle box
+ var side = Math.floor(Math.random() * 4);
+ var boxLeft = battleBox.x - 300;
+ var boxRight = battleBox.x + 300;
+ var boxTop = battleBox.y - 200;
+ var boxBottom = battleBox.y + 200;
+ switch (side) {
+ case 0:
+ // Top
+ bullet.x = boxLeft + Math.random() * 600;
+ bullet.y = boxTop - 50;
+ bullet.speedX = (Math.random() - 0.5) * 2;
+ bullet.speedY = 3 + Math.random() * 2;
+ break;
+ case 1:
+ // Right
+ bullet.x = boxRight + 50;
+ bullet.y = boxTop + Math.random() * 400;
+ bullet.speedX = -3 - Math.random() * 2;
+ bullet.speedY = (Math.random() - 0.5) * 2;
+ break;
+ case 2:
+ // Bottom
+ bullet.x = boxLeft + Math.random() * 600;
+ bullet.y = boxBottom + 50;
+ bullet.speedX = (Math.random() - 0.5) * 2;
+ bullet.speedY = -3 - Math.random() * 2;
+ break;
+ case 3:
+ // Left
+ bullet.x = boxLeft - 50;
+ bullet.y = boxTop + Math.random() * 400;
+ bullet.speedX = 3 + Math.random() * 2;
+ bullet.speedY = (Math.random() - 0.5) * 2;
+ break;
+ }
+ bullets.push(bullet);
+ game.addChild(bullet);
+}
+function updateHealthBars() {
+ // Update Kris health bar
+ var krisHealthRatio = kris.currentHP / kris.maxHP;
+ krisHealthBar.width = 200 * krisHealthRatio;
+ krisHPText.setText('KRIS HP: ' + kris.currentHP + '/' + kris.maxHP);
+ // Update monster health bar
+ var monsterHealthRatio = monster.currentHP / monster.maxHP;
+ monsterHealthBar.width = 200 * monsterHealthRatio;
+ monsterHPText.setText('MONSTER HP: ' + monster.currentHP + '/' + monster.maxHP);
+}
+// Heart movement
+game.move = function (x, y, obj) {
+ if (gameState === 'enemyTurn' && dragHeart) {
+ // Constrain heart to battle box
+ var boxLeft = battleBox.x - 285;
+ var boxRight = battleBox.x + 285;
+ var boxTop = battleBox.y - 185;
+ var boxBottom = battleBox.y + 185;
+ heart.x = Math.max(boxLeft, Math.min(boxRight, x));
+ heart.y = Math.max(boxTop, Math.min(boxBottom, y));
+ }
+};
+game.down = function (x, y, obj) {
+ if (gameState === 'enemyTurn') {
+ dragHeart = true;
+ heart.x = Math.max(battleBox.x - 285, Math.min(battleBox.x + 285, x));
+ heart.y = Math.max(battleBox.y - 185, Math.min(battleBox.y + 185, y));
+ }
+};
+game.up = function (x, y, obj) {
+ dragHeart = false;
+};
+game.update = function () {
+ updateHealthBars();
+ if (gameState === 'enemyTurn') {
+ turnTimer++;
+ attackTimer++;
+ // Spawn bullets periodically
+ if (attackTimer % 45 === 0) {
+ spawnBullet();
+ }
+ // Update bullets
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ var bullet = bullets[i];
+ // Check if bullet is off screen
+ if (bullet.x < -100 || bullet.x > 2148 || bullet.y < -100 || bullet.y > 2832) {
+ bullet.destroy();
+ bullets.splice(i, 1);
+ continue;
+ }
+ // Check collision with heart
+ if (bullet.intersects(heart)) {
+ kris.takeDamage(10);
+ bullet.destroy();
+ bullets.splice(i, 1);
+ if (kris.currentHP <= 0) {
+ gameState = 'gameOver';
+ turnText.setText('Game Over');
+ LK.showGameOver();
+ return;
+ }
+ continue;
+ }
+ }
+ // End enemy turn after 5 seconds
+ if (turnTimer >= 300) {
+ switchToPlayerTurn();
+ }
+ }
+};
\ No newline at end of file
Corazón rojo. In-Game asset. 2d. High contrast. No shadows
No cambiar nada solo que parezca más femenino
Mostruo de color blanco con pinchos azules y ojos azules dientes azules y que parece dinosaurio. In-Game asset. 2d. High contrast. No shadows. Deltarune
Puerta de piedra cerrada. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Pared de piedra. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat