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 DamageNumber = Container.expand(function (damage, color) {
var self = Container.call(this);
var damageText = new Text2(damage.toString(), {
size: 36,
fill: color
});
damageText.anchor.set(0.5, 0.5);
self.addChild(damageText);
// Animate damage number floating up and fading out
tween(self, {
y: self.y - 80,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
return self;
});
var GiantBall = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
ballGraphics.width = 80;
ballGraphics.height = 80;
ballGraphics.tint = 0x444444;
self.speedY = 0;
self.bouncing = false;
self.bounceCount = 0;
self.update = function () {
if (!self.bouncing) {
self.speedY += 0.5; // Gravity
self.y += self.speedY;
// Check if hit bottom of battle box
if (self.y >= battleBox.y + 180) {
self.y = battleBox.y + 180;
self.speedY = -self.speedY * 0.7; // Bounce with energy loss
self.bounceCount++;
self.bouncing = true;
LK.setTimeout(function () {
self.bouncing = false;
}, 100);
}
}
};
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 = 8500;
self.currentHP = 8500;
self.takeDamage = function (amount) {
self.currentHP = Math.max(0, self.currentHP - amount);
LK.effects.flashObject(monsterGraphics, 0xff0000, 500);
LK.getSound('hit').play();
};
return self;
});
var Spell = Container.expand(function () {
var self = Container.call(this);
var spellGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
spellGraphics.width = 60;
spellGraphics.height = 60;
spellGraphics.tint = 0x9933ff;
self.warned = false;
self.exploded = false;
self.update = function () {
if (!self.warned) {
// Flash purple warning
spellGraphics.alpha = 0.5;
self.warned = true;
LK.setTimeout(function () {
if (!self.exploded) {
self.exploded = true;
spellGraphics.width = 120;
spellGraphics.height = 120;
spellGraphics.alpha = 1;
spellGraphics.tint = 0xff6600;
}
}, 1500);
}
};
return self;
});
var Sword = Container.expand(function () {
var self = Container.call(this);
var swordGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
swordGraphics.width = 40;
swordGraphics.height = 100;
swordGraphics.tint = 0xcccccc;
self.warned = false;
self.falling = false;
self.speed = 0;
self.update = function () {
if (!self.warned) {
// Flash red warning
swordGraphics.tint = 0xff0000;
self.warned = true;
LK.setTimeout(function () {
self.falling = true;
self.speed = 8;
swordGraphics.tint = 0xcccccc;
}, 1000);
}
if (self.falling) {
self.y += self.speed;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Create blue stripe background pattern
for (var stripe = 0; stripe < 20; stripe++) {
var blueStripe = game.addChild(LK.getAsset('blueStripe', {
anchorX: 0,
anchorY: 0
}));
blueStripe.x = 0;
blueStripe.y = stripe * 100;
blueStripe.alpha = 0.3;
}
// Play battle music
LK.playMusic('battleMusic');
// Game state
var gameState = 'menu'; // 'menu', 'playerTurn', 'enemyTurn', 'gameOver'
var turnTimer = 0;
var attackTimer = 0;
var bullets = [];
var dragHeart = false;
var forgivenessLevel = 0; // 0 to 100
var showingActMenu = false;
var showingDescription = false;
var currentTP = 0; // 0 to 100
var tpMultiplier = 1.0; // Can be increased by lucky clothes
var defending = false;
var showingItemMenu = false;
var inventory = [{
name: 'Hamburger',
heal: 25,
type: 'heal'
}, {
name: 'Lancer Cookie',
heal: 1,
type: 'heal'
}, {
name: 'Cake',
heal: 100,
type: 'heal'
}, {
name: 'Soul Essence',
tp: 35,
type: 'tp'
}, {
name: 'Lucky Clothes',
tpBoost: 10,
type: 'tpBoost'
}, {
name: 'Frozen Hotdog',
heal: 5,
type: 'heal'
}];
// Shuffle inventory order
for (var i = inventory.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = inventory[i];
inventory[i] = inventory[j];
inventory[j] = temp;
}
// 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;
battleBox.tint = 0x000000; // Make battle box black
// Battle box green corners
var cornerTopLeft = game.addChild(LK.getAsset('battleBoxCorner', {
anchorX: 0,
anchorY: 0
}));
cornerTopLeft.x = battleBox.x - 300;
cornerTopLeft.y = battleBox.y - 200;
var cornerTopRight = game.addChild(LK.getAsset('battleBoxCorner', {
anchorX: 1,
anchorY: 0
}));
cornerTopRight.x = battleBox.x + 300;
cornerTopRight.y = battleBox.y - 200;
var cornerBottomLeft = game.addChild(LK.getAsset('battleBoxCorner', {
anchorX: 0,
anchorY: 1
}));
cornerBottomLeft.x = battleBox.x - 300;
cornerBottomLeft.y = battleBox.y + 200;
var cornerBottomRight = game.addChild(LK.getAsset('battleBoxCorner', {
anchorX: 1,
anchorY: 1
}));
cornerBottomRight.x = battleBox.x + 300;
cornerBottomRight.y = battleBox.y + 200;
// 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 = 300;
attackButton.y = 2400;
var actButton = game.addChild(new ActionButton('ACT', function () {
if (gameState === 'playerTurn') {
performAct();
}
}));
actButton.x = 550;
actButton.y = 2400;
var itemButton = game.addChild(new ActionButton('ITEM', function () {
if (gameState === 'playerTurn') {
performItem();
}
}));
itemButton.x = 800;
itemButton.y = 2400;
var defendButton = game.addChild(new ActionButton('DEFEND', function () {
if (gameState === 'playerTurn') {
performDefend();
}
}));
defendButton.x = 1050;
defendButton.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);
// Menu screen elements
var menuTitle = new Text2('DELTARUNE CHAPTER ???', {
size: 60,
fill: 0xFFFFFF
});
menuTitle.anchor.set(0.5, 0.5);
menuTitle.x = 1024;
menuTitle.y = 1200;
game.addChild(menuTitle);
var startButton = game.addChild(new ActionButton('START BATTLE', function () {
if (gameState === 'menu') {
gameState = 'playerTurn';
turnText.setText('Your Turn');
menuTitle.visible = false;
startButton.visible = false;
attackButton.visible = true;
actButton.visible = true;
itemButton.visible = true;
defendButton.visible = true;
mercyButton.visible = true;
}
}));
startButton.x = 1024;
startButton.y = 1400;
// Forgiveness bar
var forgivenessBg = game.addChild(LK.getAsset('healthBarBg', {
anchorX: 0,
anchorY: 0
}));
forgivenessBg.x = 900;
forgivenessBg.y = 300;
forgivenessBg.width = 250;
var forgivenessBar = game.addChild(LK.getAsset('healthBar', {
anchorX: 0,
anchorY: 0
}));
forgivenessBar.x = 902;
forgivenessBar.y = 302;
forgivenessBar.width = 0;
forgivenessBar.tint = 0xffff00; // Yellow color
var forgivenessText = new Text2('FORGIVENESS: 0%', {
size: 20,
fill: 0xFFFFFF
});
forgivenessText.anchor.set(0, 0);
forgivenessText.x = 900;
forgivenessText.y = 330;
game.addChild(forgivenessText);
// TP bar
var tpBg = game.addChild(LK.getAsset('healthBarBg', {
anchorX: 0,
anchorY: 0
}));
tpBg.x = 200;
tpBg.y = 300;
tpBg.width = 250;
var tpBar = game.addChild(LK.getAsset('healthBar', {
anchorX: 0,
anchorY: 0
}));
tpBar.x = 202;
tpBar.y = 302;
tpBar.width = 0;
tpBar.tint = 0xff00ff; // Purple color
var tpText = new Text2('TP: 0/100', {
size: 20,
fill: 0xFFFFFF
});
tpText.anchor.set(0, 0);
tpText.x = 200;
tpText.y = 330;
game.addChild(tpText);
// Act menu buttons
var descriptionButton = game.addChild(new ActionButton('DESCRIPTION', function () {
if (gameState === 'playerTurn' && showingActMenu) {
showDescription();
}
}));
descriptionButton.x = 400;
descriptionButton.y = 2300;
descriptionButton.visible = false;
var calmButton = game.addChild(new ActionButton('TRY TO CALM', function () {
if (gameState === 'playerTurn' && showingActMenu) {
tryToCalm();
}
}));
calmButton.x = 650;
calmButton.y = 2300;
calmButton.visible = false;
var danceButton = game.addChild(new ActionButton('DANCE (25 TP)', function () {
if (gameState === 'playerTurn' && showingActMenu && currentTP >= 25) {
performDance();
}
}));
danceButton.x = 950;
danceButton.y = 2300;
danceButton.visible = false;
var backButton = game.addChild(new ActionButton('BACK', function () {
if (gameState === 'playerTurn' && (showingActMenu || showingDescription)) {
hideActMenu();
}
}));
backButton.x = 1200;
backButton.y = 2300;
backButton.visible = false;
// Description text
var descriptionTextBox = new Text2('', {
size: 24,
fill: 0xFFFFFF
});
descriptionTextBox.anchor.set(0.5, 0.5);
descriptionTextBox.x = 1024;
descriptionTextBox.y = 2100;
game.addChild(descriptionTextBox);
descriptionTextBox.visible = false;
// Calm attempt text
var calmText = new Text2('', {
size: 24,
fill: 0xFFFFFF
});
calmText.anchor.set(0.5, 0.5);
calmText.x = 1024;
calmText.y = 2150;
game.addChild(calmText);
calmText.visible = false;
// "Can be spared" indicator
var spareIndicator = new Text2('Can be spared', {
size: 20,
fill: 0xffff00
});
spareIndicator.anchor.set(0.5, 0);
spareIndicator.x = mercyButton.x;
spareIndicator.y = mercyButton.y - 40;
game.addChild(spareIndicator);
spareIndicator.visible = false;
// Initially hide action buttons
attackButton.visible = false;
actButton.visible = false;
itemButton.visible = false;
defendButton.visible = false;
mercyButton.visible = false;
// Game functions
function performAttack() {
// Kris attack reaction - flash white and scale up briefly
tween(kris, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(kris, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
}
});
LK.effects.flashObject(kris, 0xffffff, 300);
var damage = 25;
monster.takeDamage(damage);
// Show blue damage number
var damageNumber = game.addChild(new DamageNumber(damage, 0x0066ff));
damageNumber.x = monster.x;
damageNumber.y = monster.y - 100;
LK.getSound('attack').play();
if (monster.currentHP <= 0) {
gameState = 'gameOver';
turnText.setText('Victory!');
LK.showYouWin();
return;
}
switchToEnemyTurn();
}
function performAct() {
showActMenu();
}
function showActMenu() {
showingActMenu = true;
showingDescription = false;
// Hide main action buttons
attackButton.visible = false;
actButton.visible = false;
itemButton.visible = false;
defendButton.visible = false;
mercyButton.visible = false;
// Show act menu buttons
descriptionButton.visible = true;
calmButton.visible = true;
danceButton.visible = true;
// Update dance button color based on TP
if (currentTP >= 25) {
danceButton.tint = 0xffffff;
} else {
danceButton.tint = 0x666666;
}
backButton.visible = true;
// Hide any previous text
descriptionTextBox.visible = false;
calmText.visible = false;
}
function hideActMenu() {
showingActMenu = false;
showingDescription = false;
// Show main action buttons
attackButton.visible = true;
actButton.visible = true;
itemButton.visible = true;
defendButton.visible = true;
mercyButton.visible = true;
// Hide act menu buttons
descriptionButton.visible = false;
calmButton.visible = false;
danceButton.visible = false;
backButton.visible = false;
// Hide text
descriptionTextBox.visible = false;
calmText.visible = false;
}
function showDescription() {
showingDescription = true;
descriptionTextBox.setText('DINOSAUR Attack: 10 Defense: 5 HP: 8500\nA dinosaur seeking to no longer be used as a weapon');
descriptionTextBox.visible = true;
}
function tryToCalm() {
// Kris act reaction - subtle side step
tween(kris, {
x: kris.x + 30
}, {
duration: 250,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(kris, {
x: 400
}, {
duration: 250,
easing: tween.easeIn
});
}
});
LK.effects.flashObject(kris, 0xffff00, 400);
// Increase forgiveness level
forgivenessLevel = Math.min(100, forgivenessLevel + 10);
updateForgivenessBar();
// Show calm attempt text
calmText.setText('Kris tried to calm Dinosaur. Didn\'t achieve much\nbut Dinosaur calmed down a little');
calmText.visible = true;
// Check if can be spared
if (forgivenessLevel >= 100) {
spareIndicator.visible = true;
mercyButton.tint = 0xffff00;
}
LK.setTimeout(function () {
hideActMenu();
switchToEnemyTurn();
}, 2000);
}
function performDance() {
if (currentTP < 25) return;
// Kris dance reaction - spin and bounce
tween(kris, {
rotation: Math.PI * 2,
y: kris.y - 40
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(kris, {
rotation: 0,
y: 2000
}, {
duration: 400,
easing: tween.easeIn
});
}
});
LK.effects.flashObject(kris, 0xff00ff, 800);
// Consume TP
currentTP -= 25;
updateTPBar();
// Increase forgiveness level by 20%
forgivenessLevel = Math.min(100, forgivenessLevel + 20);
updateForgivenessBar();
// Show dance text
calmText.setText('Kris performed a beautiful dance!\nDinosaur was charmed and became much calmer');
calmText.visible = true;
// Check if can be spared
if (forgivenessLevel >= 100) {
spareIndicator.visible = true;
mercyButton.tint = 0xffff00;
}
LK.setTimeout(function () {
hideActMenu();
switchToEnemyTurn();
}, 2500);
}
function performItem() {
showItemMenu();
}
function showItemMenu() {
showingItemMenu = true;
// Hide main action buttons
attackButton.visible = false;
actButton.visible = false;
itemButton.visible = false;
defendButton.visible = false;
mercyButton.visible = false;
// Show item menu
showItemInventory();
}
function hideItemMenu() {
showingItemMenu = false;
// Show main action buttons
attackButton.visible = true;
actButton.visible = true;
itemButton.visible = true;
defendButton.visible = true;
mercyButton.visible = true;
// Hide item buttons
hideItemInventory();
}
function showItemInventory() {
// Create item buttons dynamically
for (var i = 0; i < inventory.length; i++) {
var item = inventory[i];
var itemButton = game.addChild(new ActionButton(item.name, createItemUseFunction(i)));
itemButton.x = 300 + i % 3 * 250;
itemButton.y = 2200 + Math.floor(i / 3) * 80;
itemButton.itemIndex = i;
}
// Add back button
var itemBackButton = game.addChild(new ActionButton('BACK', function () {
hideItemMenu();
}));
itemBackButton.x = 1200;
itemBackButton.y = 2400;
itemBackButton.isItemBack = true;
}
function hideItemInventory() {
// Remove all item buttons
var children = game.children.slice();
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (child.itemIndex !== undefined || child.isItemBack) {
child.destroy();
}
}
}
function createItemUseFunction(itemIndex) {
return function () {
if (gameState === 'playerTurn' && showingItemMenu) {
useItem(itemIndex);
}
};
}
function useItem(itemIndex) {
var item = inventory[itemIndex];
// Kris item reaction - gentle bounce and green flash
tween(kris, {
y: kris.y - 20
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(kris, {
y: 2000
}, {
duration: 300,
easing: tween.easeIn
});
}
});
LK.effects.flashObject(kris, 0x00ff00, 500);
if (item.type === 'heal') {
var healAmount = Math.floor(kris.maxHP * item.heal / 100);
kris.currentHP = Math.min(kris.maxHP, kris.currentHP + healAmount);
// Show green healing number
var healNumber = game.addChild(new DamageNumber('+' + healAmount, 0x00ff00));
healNumber.x = kris.x;
healNumber.y = kris.y - 100;
} else if (item.type === 'tp') {
currentTP = Math.min(100, currentTP + item.tp);
updateTPBar();
// Show green TP number
var tpNumber = game.addChild(new DamageNumber('+' + item.tp + ' TP', 0x00ff00));
tpNumber.x = kris.x;
tpNumber.y = kris.y - 100;
} else if (item.type === 'tpBoost') {
tpMultiplier += item.tpBoost / 100;
// Show green boost number
var boostNumber = game.addChild(new DamageNumber('TP Boost +' + item.tpBoost + '%', 0x00ff00));
boostNumber.x = kris.x;
boostNumber.y = kris.y - 100;
}
// Remove item from inventory
inventory.splice(itemIndex, 1);
hideItemMenu();
switchToEnemyTurn();
}
function performDefend() {
// Kris defend reaction - crouch down slightly
tween(kris, {
scaleY: 0.8,
y: kris.y + 20
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(kris, {
scaleY: 1.0,
y: 2000
}, {
duration: 300,
easing: tween.easeIn
});
}
});
LK.effects.flashObject(kris, 0x0066ff, 400);
// Set defending flag and gain TP
defending = true;
var tpGain = Math.floor(15 * tpMultiplier);
currentTP = Math.min(100, currentTP + tpGain);
updateTPBar();
// Show green TP gain number
var tpNumber = game.addChild(new DamageNumber('+' + tpGain + ' TP', 0x00ff00));
tpNumber.x = kris.x;
tpNumber.y = kris.y - 100;
switchToEnemyTurn();
}
function performMercy() {
if (forgivenessLevel >= 100) {
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;
// Heart emerges from Kris's chest and moves to battle box
heart.x = kris.x;
heart.y = kris.y - 60; // Start from chest area
tween(heart, {
x: battleBox.x,
y: battleBox.y
}, {
duration: 800,
easing: tween.easeOut
});
}
function switchToPlayerTurn() {
gameState = 'playerTurn';
turnText.setText('Your Turn');
defending = false; // Reset defending flag
// Hide battle box
battleBox.alpha = 0;
// Clear bullets
for (var i = bullets.length - 1; i >= 0; i--) {
bullets[i].destroy();
bullets.splice(i, 1);
}
// Heart returns to Kris's chest area with animation
tween(heart, {
x: kris.x,
y: kris.y - 60
}, {
duration: 600,
easing: tween.easeIn
});
}
function spawnAttack() {
var attackType = Math.floor(Math.random() * 5) + 1;
var boxLeft = battleBox.x - 300;
var boxRight = battleBox.x + 300;
var boxTop = battleBox.y - 200;
var boxBottom = battleBox.y + 200;
switch (attackType) {
case 1:
// Falling swords
for (var i = 0; i < 3; i++) {
var sword = new Sword();
sword.x = boxLeft + Math.random() * 600;
sword.y = boxTop - 100;
bullets.push(sword);
game.addChild(sword);
}
break;
case 2:
// Random spell explosion
var spell = new Spell();
spell.x = boxLeft + Math.random() * 600;
spell.y = boxTop + Math.random() * 400;
bullets.push(spell);
game.addChild(spell);
break;
case 3:
// White bullets from multiple points
for (var j = 0; j < 6; j++) {
var bullet = new Bullet();
var side = Math.floor(Math.random() * 4);
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);
}
break;
case 4:
// More white bullets
for (var k = 0; k < 8; k++) {
var bullet2 = new Bullet();
bullet2.x = boxLeft + Math.random() * 600;
bullet2.y = boxTop + Math.random() * 400;
var angle = Math.random() * Math.PI * 2;
var speed = 2 + Math.random() * 3;
bullet2.speedX = Math.cos(angle) * speed;
bullet2.speedY = Math.sin(angle) * speed;
bullets.push(bullet2);
game.addChild(bullet2);
}
break;
case 5:
// Giant bouncing ball
var giantBall = new GiantBall();
giantBall.x = boxLeft + Math.random() * 600;
giantBall.y = boxTop - 100;
bullets.push(giantBall);
game.addChild(giantBall);
break;
}
}
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);
}
function updateForgivenessBar() {
var forgivenessRatio = forgivenessLevel / 100;
forgivenessBar.width = 246 * forgivenessRatio;
forgivenessText.setText('FORGIVENESS: ' + forgivenessLevel + '%');
}
function updateTPBar() {
var tpRatio = currentTP / 100;
tpBar.width = 246 * tpRatio;
tpText.setText('TP: ' + currentTP + '/100');
}
// 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();
updateForgivenessBar();
updateTPBar();
if (gameState === 'enemyTurn') {
turnTimer++;
attackTimer++;
// Spawn attacks periodically
if (attackTimer % 90 === 0) {
spawnAttack();
}
// 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)) {
var damage = 10;
if (defending) {
damage = Math.floor(damage * 0.5); // Reduce damage by 50% when defending
}
kris.takeDamage(damage);
// Show red damage number
var damageNumber = game.addChild(new DamageNumber(damage, 0xff0000));
damageNumber.x = kris.x;
damageNumber.y = kris.y - 100;
bullet.destroy();
bullets.splice(i, 1);
if (kris.currentHP <= 0) {
gameState = 'gameOver';
turnText.setText('Game Over');
LK.showGameOver();
return;
}
continue;
}
}
// End enemy turn after 7 seconds
if (turnTimer >= 420) {
switchToPlayerTurn();
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -223,8 +223,44 @@
var dragHeart = false;
var forgivenessLevel = 0; // 0 to 100
var showingActMenu = false;
var showingDescription = false;
+var currentTP = 0; // 0 to 100
+var tpMultiplier = 1.0; // Can be increased by lucky clothes
+var defending = false;
+var showingItemMenu = false;
+var inventory = [{
+ name: 'Hamburger',
+ heal: 25,
+ type: 'heal'
+}, {
+ name: 'Lancer Cookie',
+ heal: 1,
+ type: 'heal'
+}, {
+ name: 'Cake',
+ heal: 100,
+ type: 'heal'
+}, {
+ name: 'Soul Essence',
+ tp: 35,
+ type: 'tp'
+}, {
+ name: 'Lucky Clothes',
+ tpBoost: 10,
+ type: 'tpBoost'
+}, {
+ name: 'Frozen Hotdog',
+ heal: 5,
+ type: 'heal'
+}];
+// Shuffle inventory order
+for (var i = inventory.length - 1; i > 0; i--) {
+ var j = Math.floor(Math.random() * (i + 1));
+ var temp = inventory[i];
+ inventory[i] = inventory[j];
+ inventory[j] = temp;
+}
// Characters
var kris = game.addChild(new Character());
kris.x = 400;
kris.y = 2000;
@@ -241,8 +277,9 @@
}));
battleBox.x = 1024;
battleBox.y = 1600;
battleBox.alpha = 0;
+battleBox.tint = 0x000000; // Make battle box black
// Battle box green corners
var cornerTopLeft = game.addChild(LK.getAsset('battleBoxCorner', {
anchorX: 0,
anchorY: 0
@@ -297,24 +334,31 @@
if (gameState === 'playerTurn') {
performAttack();
}
}));
-attackButton.x = 400;
+attackButton.x = 300;
attackButton.y = 2400;
var actButton = game.addChild(new ActionButton('ACT', function () {
if (gameState === 'playerTurn') {
performAct();
}
}));
-actButton.x = 700;
+actButton.x = 550;
actButton.y = 2400;
var itemButton = game.addChild(new ActionButton('ITEM', function () {
if (gameState === 'playerTurn') {
performItem();
}
}));
-itemButton.x = 1000;
+itemButton.x = 800;
itemButton.y = 2400;
+var defendButton = game.addChild(new ActionButton('DEFEND', function () {
+ if (gameState === 'playerTurn') {
+ performDefend();
+ }
+}));
+defendButton.x = 1050;
+defendButton.y = 2400;
var mercyButton = game.addChild(new ActionButton('MERCY', function () {
if (gameState === 'playerTurn') {
performMercy();
}
@@ -361,8 +405,9 @@
startButton.visible = false;
attackButton.visible = true;
actButton.visible = true;
itemButton.visible = true;
+ defendButton.visible = true;
mercyButton.visible = true;
}
}));
startButton.x = 1024;
@@ -390,25 +435,57 @@
forgivenessText.anchor.set(0, 0);
forgivenessText.x = 900;
forgivenessText.y = 330;
game.addChild(forgivenessText);
+// TP bar
+var tpBg = game.addChild(LK.getAsset('healthBarBg', {
+ anchorX: 0,
+ anchorY: 0
+}));
+tpBg.x = 200;
+tpBg.y = 300;
+tpBg.width = 250;
+var tpBar = game.addChild(LK.getAsset('healthBar', {
+ anchorX: 0,
+ anchorY: 0
+}));
+tpBar.x = 202;
+tpBar.y = 302;
+tpBar.width = 0;
+tpBar.tint = 0xff00ff; // Purple color
+var tpText = new Text2('TP: 0/100', {
+ size: 20,
+ fill: 0xFFFFFF
+});
+tpText.anchor.set(0, 0);
+tpText.x = 200;
+tpText.y = 330;
+game.addChild(tpText);
// Act menu buttons
var descriptionButton = game.addChild(new ActionButton('DESCRIPTION', function () {
if (gameState === 'playerTurn' && showingActMenu) {
showDescription();
}
}));
-descriptionButton.x = 600;
+descriptionButton.x = 400;
descriptionButton.y = 2300;
descriptionButton.visible = false;
var calmButton = game.addChild(new ActionButton('TRY TO CALM', function () {
if (gameState === 'playerTurn' && showingActMenu) {
tryToCalm();
}
}));
-calmButton.x = 900;
+calmButton.x = 650;
calmButton.y = 2300;
calmButton.visible = false;
+var danceButton = game.addChild(new ActionButton('DANCE (25 TP)', function () {
+ if (gameState === 'playerTurn' && showingActMenu && currentTP >= 25) {
+ performDance();
+ }
+}));
+danceButton.x = 950;
+danceButton.y = 2300;
+danceButton.visible = false;
var backButton = game.addChild(new ActionButton('BACK', function () {
if (gameState === 'playerTurn' && (showingActMenu || showingDescription)) {
hideActMenu();
}
@@ -449,8 +526,9 @@
// Initially hide action buttons
attackButton.visible = false;
actButton.visible = false;
itemButton.visible = false;
+defendButton.visible = false;
mercyButton.visible = false;
// Game functions
function performAttack() {
// Kris attack reaction - flash white and scale up briefly
@@ -494,12 +572,20 @@
// Hide main action buttons
attackButton.visible = false;
actButton.visible = false;
itemButton.visible = false;
+ defendButton.visible = false;
mercyButton.visible = false;
// Show act menu buttons
descriptionButton.visible = true;
calmButton.visible = true;
+ danceButton.visible = true;
+ // Update dance button color based on TP
+ if (currentTP >= 25) {
+ danceButton.tint = 0xffffff;
+ } else {
+ danceButton.tint = 0x666666;
+ }
backButton.visible = true;
// Hide any previous text
descriptionTextBox.visible = false;
calmText.visible = false;
@@ -510,12 +596,14 @@
// Show main action buttons
attackButton.visible = true;
actButton.visible = true;
itemButton.visible = true;
+ defendButton.visible = true;
mercyButton.visible = true;
// Hide act menu buttons
descriptionButton.visible = false;
calmButton.visible = false;
+ danceButton.visible = false;
backButton.visible = false;
// Hide text
descriptionTextBox.visible = false;
calmText.visible = false;
@@ -557,9 +645,108 @@
hideActMenu();
switchToEnemyTurn();
}, 2000);
}
+function performDance() {
+ if (currentTP < 25) return;
+ // Kris dance reaction - spin and bounce
+ tween(kris, {
+ rotation: Math.PI * 2,
+ y: kris.y - 40
+ }, {
+ duration: 800,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(kris, {
+ rotation: 0,
+ y: 2000
+ }, {
+ duration: 400,
+ easing: tween.easeIn
+ });
+ }
+ });
+ LK.effects.flashObject(kris, 0xff00ff, 800);
+ // Consume TP
+ currentTP -= 25;
+ updateTPBar();
+ // Increase forgiveness level by 20%
+ forgivenessLevel = Math.min(100, forgivenessLevel + 20);
+ updateForgivenessBar();
+ // Show dance text
+ calmText.setText('Kris performed a beautiful dance!\nDinosaur was charmed and became much calmer');
+ calmText.visible = true;
+ // Check if can be spared
+ if (forgivenessLevel >= 100) {
+ spareIndicator.visible = true;
+ mercyButton.tint = 0xffff00;
+ }
+ LK.setTimeout(function () {
+ hideActMenu();
+ switchToEnemyTurn();
+ }, 2500);
+}
function performItem() {
+ showItemMenu();
+}
+function showItemMenu() {
+ showingItemMenu = true;
+ // Hide main action buttons
+ attackButton.visible = false;
+ actButton.visible = false;
+ itemButton.visible = false;
+ defendButton.visible = false;
+ mercyButton.visible = false;
+ // Show item menu
+ showItemInventory();
+}
+function hideItemMenu() {
+ showingItemMenu = false;
+ // Show main action buttons
+ attackButton.visible = true;
+ actButton.visible = true;
+ itemButton.visible = true;
+ defendButton.visible = true;
+ mercyButton.visible = true;
+ // Hide item buttons
+ hideItemInventory();
+}
+function showItemInventory() {
+ // Create item buttons dynamically
+ for (var i = 0; i < inventory.length; i++) {
+ var item = inventory[i];
+ var itemButton = game.addChild(new ActionButton(item.name, createItemUseFunction(i)));
+ itemButton.x = 300 + i % 3 * 250;
+ itemButton.y = 2200 + Math.floor(i / 3) * 80;
+ itemButton.itemIndex = i;
+ }
+ // Add back button
+ var itemBackButton = game.addChild(new ActionButton('BACK', function () {
+ hideItemMenu();
+ }));
+ itemBackButton.x = 1200;
+ itemBackButton.y = 2400;
+ itemBackButton.isItemBack = true;
+}
+function hideItemInventory() {
+ // Remove all item buttons
+ var children = game.children.slice();
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ if (child.itemIndex !== undefined || child.isItemBack) {
+ child.destroy();
+ }
+ }
+}
+function createItemUseFunction(itemIndex) {
+ return function () {
+ if (gameState === 'playerTurn' && showingItemMenu) {
+ useItem(itemIndex);
+ }
+ };
+}
+function useItem(itemIndex) {
+ var item = inventory[itemIndex];
// Kris item reaction - gentle bounce and green flash
tween(kris, {
y: kris.y - 20
}, {
@@ -574,17 +761,64 @@
});
}
});
LK.effects.flashObject(kris, 0x00ff00, 500);
- // Simple item use - heal
- var healAmount = Math.floor(Math.random() * 15) + 10;
- kris.currentHP = Math.min(kris.maxHP, kris.currentHP + healAmount);
- // Show green healing number
- var healNumber = game.addChild(new DamageNumber('+' + healAmount, 0x00ff00));
- healNumber.x = kris.x;
- healNumber.y = kris.y - 100;
+ if (item.type === 'heal') {
+ var healAmount = Math.floor(kris.maxHP * item.heal / 100);
+ kris.currentHP = Math.min(kris.maxHP, kris.currentHP + healAmount);
+ // Show green healing number
+ var healNumber = game.addChild(new DamageNumber('+' + healAmount, 0x00ff00));
+ healNumber.x = kris.x;
+ healNumber.y = kris.y - 100;
+ } else if (item.type === 'tp') {
+ currentTP = Math.min(100, currentTP + item.tp);
+ updateTPBar();
+ // Show green TP number
+ var tpNumber = game.addChild(new DamageNumber('+' + item.tp + ' TP', 0x00ff00));
+ tpNumber.x = kris.x;
+ tpNumber.y = kris.y - 100;
+ } else if (item.type === 'tpBoost') {
+ tpMultiplier += item.tpBoost / 100;
+ // Show green boost number
+ var boostNumber = game.addChild(new DamageNumber('TP Boost +' + item.tpBoost + '%', 0x00ff00));
+ boostNumber.x = kris.x;
+ boostNumber.y = kris.y - 100;
+ }
+ // Remove item from inventory
+ inventory.splice(itemIndex, 1);
+ hideItemMenu();
switchToEnemyTurn();
}
+function performDefend() {
+ // Kris defend reaction - crouch down slightly
+ tween(kris, {
+ scaleY: 0.8,
+ y: kris.y + 20
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(kris, {
+ scaleY: 1.0,
+ y: 2000
+ }, {
+ duration: 300,
+ easing: tween.easeIn
+ });
+ }
+ });
+ LK.effects.flashObject(kris, 0x0066ff, 400);
+ // Set defending flag and gain TP
+ defending = true;
+ var tpGain = Math.floor(15 * tpMultiplier);
+ currentTP = Math.min(100, currentTP + tpGain);
+ updateTPBar();
+ // Show green TP gain number
+ var tpNumber = game.addChild(new DamageNumber('+' + tpGain + ' TP', 0x00ff00));
+ tpNumber.x = kris.x;
+ tpNumber.y = kris.y - 100;
+ switchToEnemyTurn();
+}
function performMercy() {
if (forgivenessLevel >= 100) {
gameState = 'gameOver';
turnText.setText('You spared the monster!');
@@ -613,8 +847,9 @@
}
function switchToPlayerTurn() {
gameState = 'playerTurn';
turnText.setText('Your Turn');
+ defending = false; // Reset defending flag
// Hide battle box
battleBox.alpha = 0;
// Clear bullets
for (var i = bullets.length - 1; i >= 0; i--) {
@@ -732,8 +967,13 @@
var forgivenessRatio = forgivenessLevel / 100;
forgivenessBar.width = 246 * forgivenessRatio;
forgivenessText.setText('FORGIVENESS: ' + forgivenessLevel + '%');
}
+function updateTPBar() {
+ var tpRatio = currentTP / 100;
+ tpBar.width = 246 * tpRatio;
+ tpText.setText('TP: ' + currentTP + '/100');
+}
// Heart movement
game.move = function (x, y, obj) {
if (gameState === 'enemyTurn' && dragHeart) {
// Constrain heart to battle box
@@ -757,8 +997,9 @@
};
game.update = function () {
updateHealthBars();
updateForgivenessBar();
+ updateTPBar();
if (gameState === 'enemyTurn') {
turnTimer++;
attackTimer++;
// Spawn attacks periodically
@@ -776,8 +1017,11 @@
}
// Check collision with heart
if (bullet.intersects(heart)) {
var damage = 10;
+ if (defending) {
+ damage = Math.floor(damage * 0.5); // Reduce damage by 50% when defending
+ }
kris.takeDamage(damage);
// Show red damage number
var damageNumber = game.addChild(new DamageNumber(damage, 0xff0000));
damageNumber.x = kris.x;
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