User prompt
Hay un error que hace que el jugador se alga invisible después de un Game over y volver a entrar el cualquier dificultad quiero que resuelvas este error
User prompt
Elimina el corazón. Y el jugador después de pasar el Game over volverá a aparecer después de elegir cualquier dificultad
User prompt
En corazón vuelve a aparecer cuando se entra el cualquier dificultad
User prompt
Cuando el jugador vuelve al menu principal el juego se habrá reiniciado y elimina la pantalla el botón de records ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Cuando el jugador entra el Game over después de un rato lo mandarán al menu ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
El daño que se le hace al boss aumentara gradualmente mientas más daño se le alga al boss hasta derrotarlo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que aparezca unos números que digan el daño que se le hace al boss estos números serían grandes y rojos que aparecerían y caerían de la pantalla y desaparecerian fuera de la pantalla con un 25% de probabilidad el daño sería mucho mayor ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Cuando aparece Game over aparecerá un botón que dice volver al menu de juego elimina el botón de personalizar. Y añade que cuando queda poca vida en el jugador los objetos curativos aparecen demasiado rápido y el varios y que la velocidad de los ataques cuando el jugador le queda poca vida solo pase en las dificultades después de normal el boss atacara más rápido cuando le queda poca vida y aletoriamete aparecerá un botón de pelear dos que al presionarlo le hará 999 de daño al boss y el botón cambiará de lugar aletoriamete el botón de pelear dos aparecerá aletoriamete el un tiempo algo corto después de que el boss allá aparecido ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Cuando se le da al botón de iniciar juego aparecerá un pequeño menu antes de iniciar el juego que dice elijir nivel de dificultad fácil 120 de vida normal 100 de vida difícil 20 de vida hardcore 10 de vida imposible 1 de vida y cuando se elije iniciara el juego y le pondrá la vida que el jugador elijio ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Cuando se presiona el botón de volver a jugar reiniciara el juego aletoriamete volverá aparecer el botón de pelear después de ser utilizado y cuando el jugador se pone sobre el botón por segunda vez el boss resivira 999 de daño el botón no invocara al boss después de que el boss ya allá sido invocado el botón de pelear se tarda el aparecer hay un contador de tiempo y hay una tabla con records de tiempo el mejor tiempo se podrán el la tabla se puede cambiar el color del jugador en el menú el una pequeña opción que dice personalizar color y se puede elegir cualquier color los objetos aparecen mas rápido si el jugador tiene menos de 10 de vida pero caen mucho más rápido si el jugador choca con el boss el boss perderá 999 de vida y el jugador perderá 3 de vida ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'visible')' in or related to this line: 'fightButton.visible = false;' Line Number: 455
User prompt
Aleatoriamente el boss se riera del jugador pero si el jugador pierde toda la vida o resive daño el boss se reíra ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hay un sonido cuando el jugador se rompe y hay un sonido cuando el boss desaparece
User prompt
Cuando el jugador pierde toda la vida antes del game over el jugador se rompe ala Mita y explota antes de salir la pantalla de game over el juego se paraliza y se pone el negro enfocando al jugador cuando pierde toda la vida también pasará lo mismo pero cuando el boss pierda toda la vida el juego lo enfocará mientras el boss tiembla antes de desaparecer ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
En el menú de único hay una música relajante pero que de algún modo tiene que dar miedo y determinacion ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que el daño que se le hace al boss siga subiendo de 999 a 9999 hasta que el boss sea derrotado cuando el boss es derrotado aparecerá la pantalla de victoria con dos botones reiniciar o menu del juego tambié quiero que cada vez que se inicia el juego aparecerá un menu principal que diga undertale vs chatore al lado de la barra del juegos dice frisk y al lado de la barra del boss dice chatore al lado del texto del menu del juego al un corazón rojo y al perder toda la vida aparecera una pantalla de game over con una musica y un texto que dice tranquilo frisk lo hiciste bien pero el destino de tu alma esta el juego frisk mantente determinado en el Game over aparecerá una opción para volver a jugar ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Que cuando aparece el boss los ataques se vuelve más frecuentes y aletorios el boss desaparece un rato y mantiene el daño que se le había hecho cada vez que se le hace daño al boss aparecerá su barra de vida el boss tiene una aparecía de cuadrado el boss se mueve y lanza unos ataques blancos con apariencia de círculo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Estos ataques tengrian sus propios diseños en ataque de izquierda a derecha sería un cuadrado y el ataque de explosión seria un exagono y aparecería un botón llamado pelear y si el jugador se pone sobre el botón aparecerá una cara gigante sonriente y esa cara gigante perderá algo de vida la cara gigante tiene 999999999999 de vida y el jugador hace 1 de daño pero cada vez que el jugador ataque su daño inclementa de 1 a 100 de 101 a 201 y aumentara hasta que el jugador pegue 999 de daño
User prompt
Ava añade dos nuevos ataques el primero que sea un ataque que apareceria en la izquierda o derecha y iría hacia la dirección contraria y el segundo ataque seria una explocion el una zona aletoria apareceria un aviso antes del ataque
User prompt
Hey ava puedes añadir más ataques para el juego como unas espadas que aparecen sobre el jugador para luego caer que los ataques sea más grandes que allá más ataques como otro que salga de abajo y suba y otro que salga en la izquierda y valla ala derecha y al revés osea que salga ala derecha y valla ala izquierda el jugador tengra una barra de vida y los ataques que quitan 1 vida el jugador tengra 20 de vida y aletoriamete aparecerá algo que curará al jugador arriba y si el jugador lo toca se curará
Code edit (1 edits merged)
Please save this source code
User prompt
Dodge Rush: Undertale Escape
Initial prompt
Si ava el juego tratara de un personaje evitando ataques el personaje en el inicio será un círculo rojo y tengra que evitar objetos blancos el juego se basaría el undertale y estaria disponible para Android
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var BossProjectile = Container.expand(function (startX, startY, targetX, targetY, speed) {
var self = Container.call(this);
var projectileGraphics = self.attachAsset('bossProjectile', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = startX;
self.y = startY;
self.radius = 15;
// Calculate direction
var dx = targetX - startX;
var dy = targetY - startY;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.velocityX = dx / distance * speed;
self.velocityY = dy / distance * speed;
} else {
self.velocityX = 0;
self.velocityY = speed;
}
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
};
return self;
});
var DirectionalProjectile = Container.expand(function (fromLeft) {
var self = Container.call(this);
var projectileGraphics = self.attachAsset('square', {
anchorX: 0.5,
anchorY: 0.5
});
self.y = Math.random() * (arenaHeight - 100) + arenaY + 50;
self.radius = 15;
self.speed = 5 + gameSpeed;
if (fromLeft) {
self.x = arenaX - 50;
self.velocityX = self.speed;
} else {
self.x = arenaX + arenaWidth + 50;
self.velocityX = -self.speed;
}
self.lastX = self.x;
self.update = function () {
self.lastX = self.x;
self.x += self.velocityX;
};
return self;
});
var Explosion = Container.expand(function (targetX, targetY) {
var self = Container.call(this);
var explosionGraphics = self.attachAsset('hexagon', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = targetX;
self.y = targetY;
self.radius = 75;
self.lifeTime = 30; // Half second explosion
self.update = function () {
self.lifeTime--;
// Explosion animation
var scale = 1 - self.lifeTime / 30 * 0.5;
explosionGraphics.scaleX = scale;
explosionGraphics.scaleY = scale;
explosionGraphics.alpha = self.lifeTime / 30;
};
return self;
});
var ExplosionWarning = Container.expand(function (targetX, targetY) {
var self = Container.call(this);
var warningGraphics = self.attachAsset('projectile', {
anchorX: 0.5,
anchorY: 0.5
});
warningGraphics.width = 120;
warningGraphics.height = 120;
warningGraphics.tint = 0xFF0000;
warningGraphics.alpha = 0.5;
self.x = targetX;
self.y = targetY;
self.warningTime = 120; // 2 seconds warning
self.radius = 0; // No collision during warning
self.update = function () {
self.warningTime--;
// Pulsing warning effect
warningGraphics.alpha = Math.sin(LK.ticks * 0.5) * 0.3 + 0.5;
warningGraphics.scaleX = 1 + Math.sin(LK.ticks * 0.3) * 0.2;
warningGraphics.scaleY = 1 + Math.sin(LK.ticks * 0.3) * 0.2;
};
return self;
});
var GiantFace = Container.expand(function () {
var self = Container.call(this);
var faceGraphics = self.attachAsset('bossSquare', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 2048 / 2;
self.y = 2732 / 2;
self.health = 999999999999;
self.maxHealth = 999999999999;
self.visible = false;
self.radius = 100;
self.moveDirection = 1;
self.moveSpeed = 3;
self.attackTimer = 0;
self.disappearTimer = 0;
self.isDisappeared = false;
self.update = function () {
if (self.visible && !self.isDisappeared) {
// Boss movement
self.x += self.moveDirection * self.moveSpeed;
if (self.x <= arenaX + 100 || self.x >= arenaX + arenaWidth - 100) {
self.moveDirection *= -1;
}
// Boss attack timer
self.attackTimer++;
if (self.attackTimer >= 90) {
// Attack every 1.5 seconds
self.attackTimer = 0;
// Launch projectile at player
var bossProjectile = new BossProjectile(self.x, self.y, player.x, player.y, 5);
bossProjectiles.push(bossProjectile);
game.addChild(bossProjectile);
}
// Disappear timer
self.disappearTimer++;
if (self.disappearTimer >= 600) {
// Disappear every 10 seconds
self.disappearTimer = 0;
self.isDisappeared = true;
self.visible = false;
// Reappear after 3 seconds
LK.setTimeout(function () {
if (inBossFight) {
self.isDisappeared = false;
self.visible = true;
self.x = Math.random() * (arenaWidth - 200) + arenaX + 100;
self.y = Math.random() * (arenaHeight - 200) + arenaY + 100;
}
}, 3000);
}
}
};
return self;
});
var HealingItem = Container.expand(function () {
var self = Container.call(this);
var healingGraphics = self.attachAsset('healingItem', {
anchorX: 0.5,
anchorY: 0.5
});
healingGraphics.tint = 0x00FF00;
self.x = Math.random() * (arenaWidth - 100) + arenaX + 50;
self.y = arenaY - 50;
self.velocityY = 2;
self.radius = 25;
self.lastY = self.y;
self.update = function () {
self.lastY = self.y;
self.y += self.velocityY;
// Gentle floating animation
healingGraphics.rotation += 0.02;
healingGraphics.scaleX = 1 + Math.sin(LK.ticks * 0.1) * 0.1;
healingGraphics.scaleY = 1 + Math.sin(LK.ticks * 0.1) * 0.1;
};
return self;
});
var HorizontalProjectile = Container.expand(function (fromLeft, yPos, speed) {
var self = Container.call(this);
var projectileGraphics = self.attachAsset('projectile', {
anchorX: 0.5,
anchorY: 0.5
});
projectileGraphics.width = 40;
projectileGraphics.height = 20;
if (fromLeft) {
self.x = arenaX - 50;
self.velocityX = speed;
} else {
self.x = arenaX + arenaWidth + 50;
self.velocityX = -speed;
}
self.y = yPos;
self.radius = 15;
self.lastX = self.x;
self.update = function () {
self.lastX = self.x;
self.x += self.velocityX;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 30;
self.speed = 8;
return self;
});
var Projectile = Container.expand(function (startX, startY, targetX, targetY, speed) {
var self = Container.call(this);
var projectileGraphics = self.attachAsset('projectile', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = startX;
self.y = startY;
self.radius = 10;
// Calculate direction
var dx = targetX - startX;
var dy = targetY - startY;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.velocityX = dx / distance * speed;
self.velocityY = dy / distance * speed;
} else {
self.velocityX = 0;
self.velocityY = speed;
}
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
};
return self;
});
var Sword = Container.expand(function (targetX) {
var self = Container.call(this);
var swordGraphics = self.attachAsset('sword', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = targetX;
self.y = arenaY - 150;
self.targetY = arenaY + arenaHeight + 100;
self.radius = 20;
self.speed = 0;
self.warningTime = 120; // 2 seconds warning
self.falling = false;
self.lastY = self.y;
swordGraphics.tint = 0xFFFFFF;
self.update = function () {
if (self.warningTime > 0) {
self.warningTime--;
// Flashing warning effect
swordGraphics.alpha = Math.sin(LK.ticks * 0.3) * 0.5 + 0.5;
if (self.warningTime === 0) {
self.falling = true;
self.speed = 8;
swordGraphics.alpha = 1;
LK.getSound('swordFall').play();
}
} else if (self.falling) {
self.lastY = self.y;
self.y += self.speed;
}
};
return self;
});
var VerticalProjectile = Container.expand(function (xPos, speed) {
var self = Container.call(this);
var projectileGraphics = self.attachAsset('projectile', {
anchorX: 0.5,
anchorY: 0.5
});
projectileGraphics.width = 20;
projectileGraphics.height = 40;
self.x = xPos;
self.y = arenaY + arenaHeight + 50;
self.velocityY = -speed;
self.radius = 15;
self.lastY = self.y;
self.update = function () {
self.lastY = self.y;
self.y += self.velocityY;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game variables
var player;
var projectiles = [];
var swords = [];
var horizontalProjectiles = [];
var verticalProjectiles = [];
var healingItems = [];
var directionalProjectiles = [];
var explosionWarnings = [];
var explosions = [];
var survivalTime = 0;
var waveTimer = 0;
var attackPattern = 0;
var gameSpeed = 1;
var isDragging = false;
var playerHealth = 20;
var maxHealth = 20;
var healingTimer = 0;
var playerDamage = 1;
var giantFace;
var fightButton;
var inBossFight = false;
var bossProjectiles = [];
var bossHealthBar;
var bossHealthText;
var showBossHealth = false;
// Game state variables
var gameState = 'menu'; // 'menu', 'playing', 'gameOver'
var menuElements = [];
// UI elements
var scoreText = new Text2('Time: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Main menu elements
var titleText = new Text2('UNDERTALE VS CHATORE', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 2732 / 2 - 300;
var heartSymbol = new Text2('♥', {
size: 100,
fill: 0xFF0000
});
heartSymbol.anchor.set(0.5, 0.5);
heartSymbol.x = titleText.x + 400;
heartSymbol.y = titleText.y;
var startButton = new Text2('START GAME', {
size: 80,
fill: 0xFFFF00
});
startButton.anchor.set(0.5, 0.5);
startButton.x = 2048 / 2;
startButton.y = 2732 / 2;
startButton.radius = 150;
menuElements.push(titleText, heartSymbol, startButton);
// Add determination animation to heart
tween(heartSymbol, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(heartSymbol, {
scaleX: 1,
scaleY: 1
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Restart the animation cycle
if (gameState === 'menu') {
tween(heartSymbol, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: arguments.callee.caller
});
}
}
});
}
});
var healthText = new Text2('Frisk: 20/20', {
size: 60,
fill: 0xFF0000
});
healthText.anchor.set(0, 0);
healthText.x = 120;
healthText.y = 120;
LK.gui.topLeft.addChild(healthText);
var instructionText = new Text2('Drag to move, avoid white bullets!', {
size: 60,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 2048 / 2;
instructionText.y = 2732 / 2 + 200;
game.addChild(instructionText);
// Create arena boundaries (visual indicators)
var arenaWidth = 1800;
var arenaHeight = 2200;
var arenaX = (2048 - arenaWidth) / 2;
var arenaY = (2732 - arenaHeight) / 2;
// Initialize player
player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 / 2;
player.visible = false;
// Show menu initially
function showMenu() {
gameState = 'menu';
for (var i = 0; i < menuElements.length; i++) {
game.addChild(menuElements[i]);
}
player.visible = false;
fightButton.visible = false;
scoreText.visible = false;
healthText.visible = false;
LK.playMusic('menuMusic');
}
function hideMenu() {
for (var i = 0; i < menuElements.length; i++) {
if (menuElements[i].parent) {
menuElements[i].parent.removeChild(menuElements[i]);
}
}
player.visible = true;
scoreText.visible = true;
healthText.visible = true;
LK.stopMusic();
}
function startGame() {
gameState = 'playing';
hideMenu();
// Reset game state
survivalTime = 0;
playerHealth = 20;
maxHealth = 20;
playerDamage = 1;
gameSpeed = 1;
inBossFight = false;
giantFace.health = 999999999999;
giantFace.visible = false;
fightButton.visible = true;
healthText.setText('Frisk: ' + playerHealth + '/' + maxHealth);
// Clear all projectiles
clearAllProjectiles();
}
function clearAllProjectiles() {
// Clear all attack arrays
for (var i = projectiles.length - 1; i >= 0; i--) {
projectiles[i].destroy();
projectiles.splice(i, 1);
}
for (var i = swords.length - 1; i >= 0; i--) {
swords[i].destroy();
swords.splice(i, 1);
}
for (var i = horizontalProjectiles.length - 1; i >= 0; i--) {
horizontalProjectiles[i].destroy();
horizontalProjectiles.splice(i, 1);
}
for (var i = verticalProjectiles.length - 1; i >= 0; i--) {
verticalProjectiles[i].destroy();
verticalProjectiles.splice(i, 1);
}
for (var i = healingItems.length - 1; i >= 0; i--) {
healingItems[i].destroy();
healingItems.splice(i, 1);
}
for (var i = directionalProjectiles.length - 1; i >= 0; i--) {
directionalProjectiles[i].destroy();
directionalProjectiles.splice(i, 1);
}
for (var i = explosionWarnings.length - 1; i >= 0; i--) {
explosionWarnings[i].destroy();
explosionWarnings.splice(i, 1);
}
for (var i = explosions.length - 1; i >= 0; i--) {
explosions[i].destroy();
explosions.splice(i, 1);
}
for (var i = bossProjectiles.length - 1; i >= 0; i--) {
bossProjectiles[i].destroy();
bossProjectiles.splice(i, 1);
}
}
showMenu();
// Initialize giant face
giantFace = game.addChild(new GiantFace());
// Create fight button
fightButton = new Text2('FIGHT', {
size: 120,
fill: 0xFFFF00
});
fightButton.anchor.set(0.5, 0.5);
fightButton.x = 2048 / 2;
fightButton.y = 2732 - 200;
fightButton.radius = 100;
game.addChild(fightButton);
// Create boss health bar
bossHealthBar = new Text2('Chatore: 999999999999', {
size: 50,
fill: 0xFFFF00
});
bossHealthBar.anchor.set(0.5, 0);
bossHealthBar.visible = false;
LK.gui.top.addChild(bossHealthBar);
bossHealthText = new Text2('', {
size: 40,
fill: 0xFF0000
});
bossHealthText.anchor.set(0.5, 0);
bossHealthText.y = 60;
bossHealthText.visible = false;
LK.gui.top.addChild(bossHealthText);
// Attack pattern functions
function spawnLinearAttack() {
var side = Math.floor(Math.random() * 4);
var startX, startY, targetX, targetY;
switch (side) {
case 0:
// Top
startX = Math.random() * arenaWidth + arenaX;
startY = arenaY;
targetX = Math.random() * arenaWidth + arenaX;
targetY = arenaY + arenaHeight;
break;
case 1:
// Right
startX = arenaX + arenaWidth;
startY = Math.random() * arenaHeight + arenaY;
targetX = arenaX;
targetY = Math.random() * arenaHeight + arenaY;
break;
case 2:
// Bottom
startX = Math.random() * arenaWidth + arenaX;
startY = arenaY + arenaHeight;
targetX = Math.random() * arenaWidth + arenaX;
targetY = arenaY;
break;
case 3:
// Left
startX = arenaX;
startY = Math.random() * arenaHeight + arenaY;
targetX = arenaX + arenaWidth;
targetY = Math.random() * arenaHeight + arenaY;
break;
}
var projectile = new Projectile(startX, startY, targetX, targetY, 3 * gameSpeed);
projectiles.push(projectile);
game.addChild(projectile);
}
function spawnCircularAttack() {
var centerX = Math.random() * (arenaWidth - 200) + arenaX + 100;
var centerY = Math.random() * (arenaHeight - 200) + arenaY + 100;
var numProjectiles = 8;
for (var i = 0; i < numProjectiles; i++) {
var angle = i / numProjectiles * Math.PI * 2;
var targetX = centerX + Math.cos(angle) * 1000;
var targetY = centerY + Math.sin(angle) * 1000;
var projectile = new Projectile(centerX, centerY, targetX, targetY, 2.5 * gameSpeed);
projectiles.push(projectile);
game.addChild(projectile);
}
}
function spawnTargetedAttack() {
var side = Math.floor(Math.random() * 4);
var startX, startY;
switch (side) {
case 0:
// Top
startX = Math.random() * arenaWidth + arenaX;
startY = arenaY;
break;
case 1:
// Right
startX = arenaX + arenaWidth;
startY = Math.random() * arenaHeight + arenaY;
break;
case 2:
// Bottom
startX = Math.random() * arenaWidth + arenaX;
startY = arenaY + arenaHeight;
break;
case 3:
// Left
startX = arenaX;
startY = Math.random() * arenaHeight + arenaY;
break;
}
var projectile = new Projectile(startX, startY, player.x, player.y, 4 * gameSpeed);
projectiles.push(projectile);
game.addChild(projectile);
}
function spawnSwordAttack() {
var numSwords = Math.floor(Math.random() * 3) + 2; // 2-4 swords
for (var i = 0; i < numSwords; i++) {
var swordX = Math.random() * (arenaWidth - 80) + arenaX + 40;
var sword = new Sword(swordX);
swords.push(sword);
game.addChild(sword);
}
}
function spawnHorizontalAttack() {
var fromLeft = Math.random() < 0.5;
var yPos = Math.random() * (arenaHeight - 100) + arenaY + 50;
var speed = 4 + gameSpeed;
var projectile = new HorizontalProjectile(fromLeft, yPos, speed);
horizontalProjectiles.push(projectile);
game.addChild(projectile);
}
function spawnVerticalAttack() {
var xPos = Math.random() * (arenaWidth - 100) + arenaX + 50;
var speed = 4 + gameSpeed;
var projectile = new VerticalProjectile(xPos, speed);
verticalProjectiles.push(projectile);
game.addChild(projectile);
}
function spawnDirectionalAttack() {
var fromLeft = Math.random() < 0.5;
var projectile = new DirectionalProjectile(fromLeft);
directionalProjectiles.push(projectile);
game.addChild(projectile);
}
function spawnExplosionAttack() {
var targetX = Math.random() * (arenaWidth - 200) + arenaX + 100;
var targetY = Math.random() * (arenaHeight - 200) + arenaY + 100;
// First spawn warning
var warning = new ExplosionWarning(targetX, targetY);
explosionWarnings.push(warning);
game.addChild(warning);
}
function spawnHealingItem() {
if (Math.random() < 0.3 && playerHealth < maxHealth) {
// 30% chance if health not full
var healingItem = new HealingItem();
healingItems.push(healingItem);
game.addChild(healingItem);
}
}
// Touch controls
game.down = function (x, y, obj) {
// Handle menu interactions
if (gameState === 'menu') {
var startDx = x - startButton.x;
var startDy = y - startButton.y;
var startDistance = Math.sqrt(startDx * startDx + startDy * startDy);
if (startDistance < startButton.radius) {
startGame();
return;
}
return;
}
if (gameState !== 'playing') return;
// Check if touching fight button
var dx = x - fightButton.x;
var dy = y - fightButton.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < fightButton.radius) {
// Start boss fight
inBossFight = true;
giantFace.visible = true;
fightButton.visible = false;
return;
}
// Check if touching giant face during boss fight
if (inBossFight && giantFace.visible) {
var faceDx = x - giantFace.x;
var faceDy = y - giantFace.y;
var faceDistance = Math.sqrt(faceDx * faceDx + faceDy * faceDy);
if (faceDistance < giantFace.radius) {
// Attack giant face
giantFace.health -= playerDamage;
LK.effects.flashObject(giantFace, 0xff0000, 200);
// Show boss health bar when damaged
showBossHealth = true;
bossHealthBar.visible = true;
bossHealthText.visible = true;
bossHealthBar.setText('Chatore: ' + giantFace.health.toFixed(0));
bossHealthText.setText('Damage: ' + playerDamage);
// Hide health bar after 3 seconds
LK.setTimeout(function () {
showBossHealth = false;
bossHealthBar.visible = false;
bossHealthText.visible = false;
}, 3000);
// Increase player damage - continues scaling beyond 999
if (playerDamage < 9999) {
if (playerDamage < 100) {
playerDamage++;
} else if (playerDamage < 999) {
playerDamage++;
} else {
// After 999, increase by larger amounts
playerDamage += 10;
}
}
// Check if boss is defeated
if (giantFace.health <= 0) {
LK.showYouWin();
}
return;
}
}
// Handle game over interactions
if (gameState === 'gameOver') {
// Check if touching play again button
if (gameOverElements.length > 2) {
var playAgainButton = gameOverElements[2];
var againDx = x - playAgainButton.x;
var againDy = y - playAgainButton.y;
var againDistance = Math.sqrt(againDx * againDx + againDy * againDy);
if (againDistance < playAgainButton.radius) {
// Clean up game over screen
for (var i = 0; i < gameOverElements.length; i++) {
if (gameOverElements[i].parent) {
gameOverElements[i].parent.removeChild(gameOverElements[i]);
}
}
gameOverElements = [];
LK.stopMusic();
startGame();
return;
}
}
return;
}
isDragging = true;
player.x = x;
player.y = y;
// Hide instruction text after first interaction
if (instructionText.parent) {
instructionText.parent.removeChild(instructionText);
}
};
game.move = function (x, y, obj) {
if (gameState === 'playing' && isDragging && !inBossFight) {
// Keep player within arena bounds
player.x = Math.max(arenaX + player.radius, Math.min(arenaX + arenaWidth - player.radius, x));
player.y = Math.max(arenaY + player.radius, Math.min(arenaY + arenaHeight - player.radius, y));
}
};
game.up = function (x, y, obj) {
isDragging = false;
};
// Collision detection
function checkCollision(obj1, obj2) {
var dx = obj1.x - obj2.x;
var dy = obj1.y - obj2.y;
var distance = Math.sqrt(dx * dx + dy * dy);
return distance < obj1.radius + obj2.radius;
}
function takeDamage() {
playerHealth--;
healthText.setText('Frisk: ' + playerHealth + '/' + maxHealth);
LK.getSound('Golpear').play();
LK.effects.flashObject(player, 0xff0000, 500);
if (playerHealth <= 0) {
gameState = 'gameOver';
showGameOver();
}
}
function healPlayer() {
if (playerHealth < maxHealth) {
playerHealth = Math.min(playerHealth + 3, maxHealth);
healthText.setText('Frisk: ' + playerHealth + '/' + maxHealth);
LK.getSound('heal').play();
LK.effects.flashObject(player, 0x00ff00, 500);
}
}
function showGameOver() {
LK.playMusic('gameOverMusic');
// Create game over screen
var gameOverBg = new Text2('', {
size: 1,
fill: 0x000000
});
gameOverBg.width = 2048;
gameOverBg.height = 2732;
gameOverBg.x = 0;
gameOverBg.y = 0;
game.addChild(gameOverBg);
var gameOverText = new Text2('Tranquilo Frisk, lo hiciste bien\npero el destino de tu alma esta\nen el juego Frisk.\nMantente determinado.', {
size: 60,
fill: 0xFFFFFF
});
gameOverText.anchor.set(0.5, 0.5);
gameOverText.x = 2048 / 2;
gameOverText.y = 2732 / 2 - 100;
game.addChild(gameOverText);
var playAgainButton = new Text2('VOLVER A JUGAR', {
size: 80,
fill: 0xFFFF00
});
playAgainButton.anchor.set(0.5, 0.5);
playAgainButton.x = 2048 / 2;
playAgainButton.y = 2732 / 2 + 150;
playAgainButton.radius = 200;
game.addChild(playAgainButton);
// Store game over elements for cleanup
gameOverElements = [gameOverBg, gameOverText, playAgainButton];
}
var gameOverElements = [];
// Main game loop
game.update = function () {
// Handle game over button click
if (gameState === 'gameOver') {
return; // Don't run game logic during game over
}
if (gameState !== 'playing') {
return; // Don't run game logic during menu
}
survivalTime++;
waveTimer++;
// Update survival time display
var seconds = Math.floor(survivalTime / 60);
scoreText.setText('Time: ' + seconds + 's');
LK.setScore(seconds);
// Increase difficulty over time
if (survivalTime % 300 === 0) {
// Every 5 seconds
gameSpeed += 0.1;
}
// Spawn attacks based on patterns
if (inBossFight) {
// More frequent and random attacks during boss fight
if (waveTimer >= 20 + Math.random() * 20) {
// Random timing between 20-40 frames
waveTimer = 0;
attackPattern = Math.floor(Math.random() * 8);
switch (attackPattern) {
case 0:
spawnLinearAttack();
break;
case 1:
spawnCircularAttack();
break;
case 2:
spawnTargetedAttack();
break;
case 3:
spawnSwordAttack();
break;
case 4:
spawnHorizontalAttack();
break;
case 5:
spawnVerticalAttack();
break;
case 6:
spawnDirectionalAttack();
break;
case 7:
spawnExplosionAttack();
break;
}
}
} else if (waveTimer >= 60 - gameSpeed * 5) {
// Normal attack patterns when not in boss fight
waveTimer = 0;
attackPattern = Math.floor(Math.random() * 8);
switch (attackPattern) {
case 0:
spawnLinearAttack();
break;
case 1:
if (survivalTime > 300) spawnCircularAttack(); // Unlock after 5 seconds
else spawnLinearAttack();
break;
case 2:
if (survivalTime > 600) spawnTargetedAttack(); // Unlock after 10 seconds
else spawnLinearAttack();
break;
case 3:
if (survivalTime > 900) spawnSwordAttack(); // Unlock after 15 seconds
else spawnLinearAttack();
break;
case 4:
if (survivalTime > 1200) spawnHorizontalAttack(); // Unlock after 20 seconds
else spawnLinearAttack();
break;
case 5:
if (survivalTime > 1500) spawnVerticalAttack(); // Unlock after 25 seconds
else spawnLinearAttack();
break;
case 6:
if (survivalTime > 1800) spawnDirectionalAttack(); // Unlock after 30 seconds
else spawnLinearAttack();
break;
case 7:
if (survivalTime > 2100) spawnExplosionAttack(); // Unlock after 35 seconds
else spawnLinearAttack();
break;
}
}
// Spawn healing items occasionally
healingTimer++;
if (healingTimer >= 600) {
// Every 10 seconds
healingTimer = 0;
spawnHealingItem();
}
// Update projectiles
for (var i = projectiles.length - 1; i >= 0; i--) {
var projectile = projectiles[i];
// Check collision with player
if (checkCollision(player, projectile)) {
takeDamage();
projectile.destroy();
projectiles.splice(i, 1);
continue;
}
// Remove projectiles that are off screen
if (projectile.x < -100 || projectile.x > 2148 || projectile.y < -100 || projectile.y > 2832) {
projectile.destroy();
projectiles.splice(i, 1);
}
}
// Update swords
for (var i = swords.length - 1; i >= 0; i--) {
var sword = swords[i];
if (sword.falling && checkCollision(player, sword)) {
takeDamage();
sword.destroy();
swords.splice(i, 1);
continue;
}
if (sword.y > arenaY + arenaHeight + 100) {
sword.destroy();
swords.splice(i, 1);
}
}
// Update horizontal projectiles
for (var i = horizontalProjectiles.length - 1; i >= 0; i--) {
var hProjectile = horizontalProjectiles[i];
if (checkCollision(player, hProjectile)) {
takeDamage();
hProjectile.destroy();
horizontalProjectiles.splice(i, 1);
continue;
}
if (hProjectile.x < arenaX - 100 || hProjectile.x > arenaX + arenaWidth + 100) {
hProjectile.destroy();
horizontalProjectiles.splice(i, 1);
}
}
// Update vertical projectiles
for (var i = verticalProjectiles.length - 1; i >= 0; i--) {
var vProjectile = verticalProjectiles[i];
if (checkCollision(player, vProjectile)) {
takeDamage();
vProjectile.destroy();
verticalProjectiles.splice(i, 1);
continue;
}
if (vProjectile.y < arenaY - 100) {
vProjectile.destroy();
verticalProjectiles.splice(i, 1);
}
}
// Update healing items
for (var i = healingItems.length - 1; i >= 0; i--) {
var healingItem = healingItems[i];
if (checkCollision(player, healingItem)) {
healPlayer();
healingItem.destroy();
healingItems.splice(i, 1);
continue;
}
if (healingItem.y > arenaY + arenaHeight + 100) {
healingItem.destroy();
healingItems.splice(i, 1);
}
}
// Update directional projectiles
for (var i = directionalProjectiles.length - 1; i >= 0; i--) {
var dProjectile = directionalProjectiles[i];
if (checkCollision(player, dProjectile)) {
takeDamage();
dProjectile.destroy();
directionalProjectiles.splice(i, 1);
continue;
}
if (dProjectile.x < arenaX - 100 || dProjectile.x > arenaX + arenaWidth + 100) {
dProjectile.destroy();
directionalProjectiles.splice(i, 1);
}
}
// Update explosion warnings
for (var i = explosionWarnings.length - 1; i >= 0; i--) {
var warning = explosionWarnings[i];
if (warning.warningTime <= 0) {
// Create explosion
var explosion = new Explosion(warning.x, warning.y);
explosions.push(explosion);
game.addChild(explosion);
warning.destroy();
explosionWarnings.splice(i, 1);
}
}
// Update explosions
for (var i = explosions.length - 1; i >= 0; i--) {
var explosion = explosions[i];
if (explosion.lifeTime > 0 && checkCollision(player, explosion)) {
takeDamage();
}
if (explosion.lifeTime <= 0) {
explosion.destroy();
explosions.splice(i, 1);
}
}
// Update boss projectiles
for (var i = bossProjectiles.length - 1; i >= 0; i--) {
var bossProjectile = bossProjectiles[i];
// Check collision with player
if (checkCollision(player, bossProjectile)) {
takeDamage();
bossProjectile.destroy();
bossProjectiles.splice(i, 1);
continue;
}
// Remove projectiles that are off screen
if (bossProjectile.x < -100 || bossProjectile.x > 2148 || bossProjectile.y < -100 || bossProjectile.y > 2832) {
bossProjectile.destroy();
bossProjectiles.splice(i, 1);
}
}
// Play music
if (survivalTime === 1) {
LK.playMusic('battle');
}
}; ===================================================================
--- original.js
+++ change.js
@@ -358,8 +358,38 @@
startButton.x = 2048 / 2;
startButton.y = 2732 / 2;
startButton.radius = 150;
menuElements.push(titleText, heartSymbol, startButton);
+// Add determination animation to heart
+tween(heartSymbol, {
+ scaleX: 1.2,
+ scaleY: 1.2
+}, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(heartSymbol, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ // Restart the animation cycle
+ if (gameState === 'menu') {
+ tween(heartSymbol, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: arguments.callee.caller
+ });
+ }
+ }
+ });
+ }
+});
var healthText = new Text2('Frisk: 20/20', {
size: 60,
fill: 0xFF0000
});
@@ -394,8 +424,9 @@
player.visible = false;
fightButton.visible = false;
scoreText.visible = false;
healthText.visible = false;
+ LK.playMusic('menuMusic');
}
function hideMenu() {
for (var i = 0; i < menuElements.length; i++) {
if (menuElements[i].parent) {
@@ -404,8 +435,9 @@
}
player.visible = true;
scoreText.visible = true;
healthText.visible = true;
+ LK.stopMusic();
}
function startGame() {
gameState = 'playing';
hideMenu();
Un corazón rojo. In-Game asset. 2d. High contrast
Una espada pequeña de color todo blanco. In-Game asset. 2d. High contrast. No shadows
Bola de fuego de color blanco. In-Game asset. 2d. High contrast. No shadows
Un botiquín de color verde con estrellitas. In-Game asset. 2d. High contrast. No shadows
Que la espada este alrevés
Bomba blanca. In-Game asset. 2d. High contrast. No shadows
Cara sonriente malvada de color azul similar ala cara de chara se undertale. In-Game asset. 2d. High contrast. No shadows
Bola de fuego de color blanco y con cara azul. In-Game asset. 2d. High contrast. No shadows