User prompt
Sube más al jugador en la pantalla para que no interfiera con la barras de ansiedad y credibilidad
User prompt
Peor dejalas las barras de ansidad y credibilidad en la parte baja de la pantalla por favor
User prompt
Ajusta mejor los texto para el turno del jugador los ataques no se ven bien, tambien puedes poner la barra de ansiedad arriba y texto "Ansiedad" debajo de ella? haz lo mismo con la barra de credibilidad por favor
User prompt
AHora tambien has los cuadros dentro de los cuales están los textos más grandes por favor, si algo se sale de la pantalla ajusta el texto para que no salga
User prompt
Genial, un detalle menor podrias hacer un pco más grande la letra de todo? es que siento que no se ve mucho
User prompt
Bueno no se arregla pero estáq bien, ahora cuando el enemigo muere no deberia poder tirar más ataques, cuando lo probé tiró ataques puedes solucionarlo?
User prompt
No se sigue sin ver la barra de salud del enemigo despues de darle continuar
User prompt
Okey, casi está bien, soluciones un pequeño bug que noté. Apenas empieza el nivel la barra de salud del enmigo no se puede ver y cuando se le da el primer ataque la barra de salud se ve en color negro, puede arreglar eso primero?
User prompt
si
User prompt
si
User prompt
si
User prompt
Puedes poner un poco más abajo al enemigo por favor? para que la barra de vida no lo tape
User prompt
SUper me gusta, quiero que hagas explicita la barra de vida del enemigo en la parte superior ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bien un cambio más es que quiero que cuando la barra de ansiedad suba, la credibilidad baje tambien quita la parte de arriba que dice puntos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Si ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sigue sin funcionar bien, quiero que entonces el enemigo tire sus 3 ataques, si el jugador a esquivado el ultimo ataque que salga el cuadro de texto para que el jugador pueda atacar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
A ver intentemos otra cosa hasta que el jugador no precione que ataque quiere hacer el enemigo no deberia poder atacar, arreglemos eso primero ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Okey está funcionando masomenos, quiero que cuando el ultimo ataque del enemigo sea esquivado o recibido por el jugador salga el cuadro de texto para que el jugador pueda hacer su ataque ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
intenta otra vez ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Por ahora solo que funcione, en este momento el enemigo siempre está atacando y el jugador solo tiene unos segundos para presionar su ataque por lo que quiero que arreglemos primero esto ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Okey quiero que el jugador este arriba de las barras de ansiedad y credibilidad primero que todo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Pero no me puedo mover primero que todo jajajja
User prompt
Okey me gusta quiero intentar hacer algo un poco diferente, quiero la mecanica principal sea por turnos primero atacará el enemigo con las letras y luego atacaré yo con algo relacionado a la cosas buenas de tutorias, la barra de ansiedad subirá cada vez que el enemigo me ataque y la confianza cuando yo atine los golpes, quiero los medidores de ansiedad y credibilidad estén en la parte inferior mejor, muy al estilo Undertale ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
si
User prompt
Ahora los dialogos se dañaron se salen de la pantalla
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemigo', {
anchorX: 0.5,
anchorY: 0.5
});
// Health properties
self.health = 100;
self.maxHealth = 100;
// Health bar will be created in GUI instead of attached to enemy
var healthBarBg = null;
var healthBar = null;
// Subtle animation properties
self.animTimer = 0;
self.baseX = 0;
self.update = function () {
// Subtle side-to-side movement
self.animTimer += 0.05;
self.x = self.baseX + Math.sin(self.animTimer) * 30;
};
// Method to show attack effect
self.showAttackEffect = function () {
// Flash effect when attacking
tween(enemyGraphics, {
tint: 0xff4444
}, {
duration: 150,
onFinish: function onFinish() {
tween(enemyGraphics, {
tint: 0xffffff
}, {
duration: 150
});
}
});
};
// Method to take damage
self.takeDamage = function (amount) {
if (amount === undefined) amount = 20;
self.health = Math.max(0, self.health - amount);
self.updateHealthBar();
// Flash red effect when taking damage
tween(enemyGraphics, {
tint: 0xff0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(enemyGraphics, {
tint: 0xffffff
}, {
duration: 200
});
}
});
// Check if enemy is defeated
if (self.health <= 0) {
// Hide enemy
self.visible = false;
// Hide health bar elements
if (healthBar) healthBar.visible = false;
if (healthBarBg) healthBarBg.visible = false;
// Enemy defeated - advance level
level++;
if (level > maxLevel) {
LK.showYouWin();
} else {
// Reset enemy health for next level
self.health = self.maxHealth;
// Show next level dialogue
showDialogue(levelNarratives[level - 1]);
}
}
};
// Method to initialize health bar in GUI
self.initHealthBar = function () {
if (!healthBarBg) {
// Health bar background - top center
healthBarBg = LK.gui.top.addChild(LK.getAsset('enemyHealthBarBg', {
anchorX: 0.5,
anchorY: 0
}));
healthBarBg.y = 100;
healthBarBg.visible = true;
// Health bar - top center
healthBar = LK.gui.top.addChild(LK.getAsset('enemyHealthBar', {
anchorX: 0.5,
anchorY: 0
}));
healthBar.y = 100;
healthBar.visible = true;
// Enemy health label
var enemyHealthLabel = LK.gui.top.addChild(new Text2('Vida del Enemigo', {
size: 36,
fill: 0xffffff
}));
enemyHealthLabel.anchor.set(0.5, 0);
enemyHealthLabel.y = 70;
// Initialize health bar display
self.updateHealthBar();
}
};
// Method to update health bar visual
self.updateHealthBar = function () {
if (!healthBar || !healthBarBg) return;
// Make sure health bar is visible
healthBar.visible = true;
healthBarBg.visible = true;
var healthPercentage = self.health / self.maxHealth;
healthBar.width = 400 * healthPercentage;
// Change color based on health level
if (healthPercentage > 0.6) {
healthBar.tint = 0x00ff00; // Green
} else if (healthPercentage > 0.3) {
healthBar.tint = 0xffff00; // Yellow
} else {
healthBar.tint = 0xff0000; // Red
}
};
return self;
});
var GreenTextAttack = Container.expand(function () {
var self = Container.call(this);
// Create random positive text
var positiveTexts = ['CALMA', 'PAZ', 'FUERZA', 'ESPERANZA', 'CONFIANZA'];
var randomText = positiveTexts[Math.floor(Math.random() * positiveTexts.length)];
var textGraphics = self.addChild(new Text2(randomText, {
size: getTextSize(true, level),
fill: 0x00ff00,
stroke: 0x000000,
strokeThickness: 3
}));
textGraphics.anchor.set(0.5, 0.5);
self.speed = 5;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
// Movement properties
self.speed = HEART_SPEED;
self.isMovingLeft = false;
self.isMovingRight = false;
// Health
self.health = 100;
self.update = function () {
// Keyboard movement
if (self.isMovingLeft) {
self.x -= self.speed;
}
if (self.isMovingRight) {
self.x += self.speed;
}
// Boundary checking
if (self.x < GAME_LEFT + HEART_MARGIN) {
self.x = GAME_LEFT + HEART_MARGIN;
}
if (self.x > GAME_RIGHT - HEART_MARGIN) {
self.x = GAME_RIGHT - HEART_MARGIN;
}
};
self.takeDamage = function (amount) {
if (amount === undefined) amount = 10;
self.health = Math.max(0, self.health - amount);
// Flash red effect
tween(heartGraphics, {
tint: 0xff0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(heartGraphics, {
tint: 0xffffff
}, {
duration: 200
});
}
});
if (self.health <= 0) {
LK.showGameOver();
}
};
return self;
});
var TechniqueMenu = Container.expand(function () {
var self = Container.call(this);
// Background
var bg = self.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
bg.width = 700;
bg.height = 480;
bg.tint = 0x333333;
// Title
var title = self.addChild(new Text2('Técnica de Relajación', {
size: 48,
fill: 0xffffff
}));
title.anchor.set(0.5, 0.5);
title.y = -120;
// Techniques
var techniques = ['Respiración Profunda', 'Mindfulness', 'Relajación Muscular'];
var selectedTechnique = techniques[Math.floor(Math.random() * techniques.length)];
var techniqueText = self.addChild(new Text2(selectedTechnique, {
size: 42,
fill: 0x00ff00
}));
techniqueText.anchor.set(0.5, 0.5);
techniqueText.y = -50;
// Instructions
var instruction = self.addChild(new Text2('Toca para aplicar', {
size: 36,
fill: 0xcccccc
}));
instruction.anchor.set(0.5, 0.5);
instruction.y = 20;
self.duration = 0;
self.maxDuration = 3000; // 3 seconds
self.update = function () {
self.duration += 16.67;
if (self.duration >= self.maxDuration) {
self.destroy();
}
};
self.down = function () {
// Apply technique - boost credibilidad
credibilidad = Math.min(100, credibilidad + 15);
updateBars();
self.destroy();
};
return self;
});
var TextAttack = Container.expand(function () {
var self = Container.call(this);
// Create random attack text
var attackTexts = ['ESTRÉS', 'MIEDO', 'PÁNICO', 'DUDAS', 'CRÍTICAS'];
var randomText = attackTexts[Math.floor(Math.random() * attackTexts.length)];
var textGraphics = self.addChild(new Text2(randomText, {
size: getTextSize(false, level),
fill: 0xff0000,
stroke: 0x000000,
strokeThickness: 3
}));
textGraphics.anchor.set(0.5, 0.5);
self.speed = 5;
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game Constants
// Turn-based constants
var ENEMY_ATTACK_DURATION = 3000; // 3 seconds for enemy attack phase
var PLAYER_ATTACK_DURATION = 3000; // 3 seconds for player attack phase
var ATTACKS_PER_TURN = 3; // Number of attacks enemy launches per turn
var LEVEL_DIFF = 5;
var MAX_LEVEL = 10;
var WIN_CRED = 60;
var LEVEL_CRED_BOOST = 5;
var GAME_LEFT = 300;
var GAME_RIGHT = 1748;
var GAME_TOP = 200;
var GAME_BOTTOM = 2732;
var GAME_WIDTH = GAME_RIGHT - GAME_LEFT;
// Heart movement constants
var HEART_SPEED = 8;
var HEART_MARGIN = 60;
// Text size scaling function
function getTextSize(isGreen, currentLevel) {
var baseSize = 20;
var sizeMultiplier = 10;
var scale;
if (isGreen) {
// Green words: size 5 at level 1, size 1 at level 5
scale = 6 - currentLevel;
} else {
// Red words: size 1 at level 1, size 5 at level 5
scale = currentLevel;
}
// Ensure scale is between 1 and 5
scale = Math.max(1, Math.min(5, scale));
return baseSize + scale * sizeMultiplier;
}
// Game state management
var gameState = 'menu'; // 'menu', 'dialogue', 'enemyTurn', 'playerTurn', 'transition'
var menuContainer = game.addChild(new Container());
// Turn-based variables
var currentTurn = 'enemy'; // 'enemy' or 'player'
var turnTimer = 0;
var attacksLaunched = 0;
var attackTimer = 0;
// Game variables
var level = 1;
var maxLevel = 5;
var dialogueContainer = game.addChild(new Container());
dialogueContainer.visible = false;
// Level narratives
var levelNarratives = ["Nivel 1: Bienvenido a tu primera sesión de tutoría. Los pensamientos negativos comenzarán lentamente.", "Nivel 2: Bien hecho. Ahora los ataques serán más frecuentes. Mantén la calma y usa las técnicas.", "Nivel 3: Excelente progreso. Los pensamientos llegan más rápido, pero ya tienes más experiencia.", "Nivel 4: Casi terminas tu entrenamiento. Los ataques son intensos, confía en tu preparación.", "Nivel 5: Nivel final. Domina completamente las técnicas contra los ataques más desafiantes."];
var score = 0;
var ansiedad = 0;
var credibilidad = 50;
// UI Elements
var ansiedadBarBg = null,
ansiedadBar = null,
credibilidadBarBg = null,
credibilidadBar = null;
var levelText = null,
scoreText = null;
// Initialize UI
function initializeUI() {
// Ansiedad bar - bottom left
ansiedadBarBg = LK.gui.bottomLeft.addChild(LK.getAsset('ansiedadBarBg', {
anchorX: 0,
anchorY: 1
}));
ansiedadBarBg.x = 120;
ansiedadBarBg.y = -50;
ansiedadBar = LK.gui.bottomLeft.addChild(LK.getAsset('ansiedadBar', {
anchorX: 0,
anchorY: 1
}));
ansiedadBar.x = 120;
ansiedadBar.y = -50;
// Credibilidad bar - bottom right
credibilidadBarBg = LK.gui.bottomRight.addChild(LK.getAsset('credibilidadBarBg', {
anchorX: 1,
anchorY: 1
}));
credibilidadBarBg.x = -120;
credibilidadBarBg.y = -50;
credibilidadBar = LK.gui.bottomRight.addChild(LK.getAsset('credibilidadBar', {
anchorX: 1,
anchorY: 1
}));
credibilidadBar.x = -120;
credibilidadBar.y = -50;
// Text labels
var ansiedadLabel = LK.gui.bottomLeft.addChild(new Text2('Ansiedad', {
size: 30,
fill: 0xffffff
}));
ansiedadLabel.x = 10;
ansiedadLabel.y = -60;
var credibilidadLabel = LK.gui.bottomRight.addChild(new Text2('Credibilidad', {
size: 30,
fill: 0xffffff
}));
credibilidadLabel.anchor.set(1, 1);
credibilidadLabel.x = -10;
credibilidadLabel.y = -60;
// Level and score - keep at top
levelText = LK.gui.topRight.addChild(new Text2('Nivel: 1', {
size: 36,
fill: 0xffffff
}));
levelText.anchor.set(1, 0);
levelText.x = -20;
levelText.y = 50;
}
function updateBars() {
// Update bar widths based on values
var ansiedadWidth = ansiedad / 100 * 300;
var credibilidadWidth = credibilidad / 100 * 300;
ansiedadBar.width = ansiedadWidth;
credibilidadBar.width = credibilidadWidth;
// Adjust credibilidad bar position since it's right-anchored
credibilidadBar.x = -120 - (300 - credibilidadWidth);
// Update text
levelText.setText('Nivel: ' + level);
}
function showDialogue(text) {
gameState = 'dialogue';
dialogueContainer.visible = true;
// Clear previous dialogue
dialogueContainer.removeChildren();
// Dialogue background
var dialogueBg = dialogueContainer.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0
}));
dialogueBg.width = 1900;
dialogueBg.height = 280;
dialogueBg.tint = 0x333333;
dialogueBg.x = 1024;
dialogueBg.y = 180;
// Dialogue text
var dialogueText = dialogueContainer.addChild(new Text2(text, {
size: 40,
fill: 0xffffff
}));
dialogueText.anchor.set(0.5, 0.5);
dialogueText.x = 1024;
dialogueText.y = 280;
// Continue button
var continueBtn = dialogueContainer.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
continueBtn.width = 380;
continueBtn.height = 100;
continueBtn.tint = 0x00aa00;
continueBtn.x = 1024;
continueBtn.y = 410;
var continueText = dialogueContainer.addChild(new Text2('Continuar', {
size: 48,
fill: 0xffffff
}));
continueText.anchor.set(0.5, 0.5);
continueText.x = continueBtn.x;
continueText.y = continueBtn.y;
continueBtn.down = function () {
dialogueContainer.visible = false;
gameState = 'enemyTurn'; // Start with enemy turn
// Initialize and show UI if not already done
if (!ansiedadBarBg || ansiedadBarBg && !ansiedadBarBg.parent) {
initializeUI();
}
// Initialize enemy health bar
enemy.initHealthBar();
// Show enemy and health bar again
enemy.visible = true;
// Ensure health bar is visible and properly updated
enemy.updateHealthBar();
updateBars();
heart.visible = true;
};
}
// Create menu elements
var logo = menuContainer.addChild(LK.getAsset('gameLogo', {
anchorX: 0.5,
anchorY: 0.5
}));
logo.x = 2048 / 2;
logo.y = 2732 / 2 - 250;
// Create play button
var playButton = menuContainer.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
playButton.width = 500;
playButton.height = 150;
playButton.x = 2048 / 2;
playButton.y = 2732 / 2 + 100;
// Play button text
var playText = menuContainer.addChild(new Text2('JUGAR', {
size: 90,
fill: 0xFFFFFF
}));
playText.anchor.set(0.5, 0.5);
playText.x = playButton.x;
playText.y = playButton.y;
// Play button interaction
playButton.down = function (x, y, obj) {
// Flash button on press
tween(playButton, {
tint: 0xffffff
}, {
duration: 100,
onFinish: function onFinish() {
tween(playButton, {
tint: 0xffffff
}, {
duration: 100
});
}
});
};
playButton.up = function (x, y, obj) {
// Show level dialogue first
menuContainer.visible = false;
showDialogue(levelNarratives[level - 1]);
};
// Create the enemy
var enemy = game.addChild(new Enemy());
enemy.x = 2048 / 2;
enemy.baseX = enemy.x;
enemy.y = GAME_TOP + 300; // Moved down further to avoid health bar overlap
enemy.visible = false;
// Create the heart character
var heart = game.addChild(new Heart());
heart.x = 2048 / 2;
heart.y = GAME_BOTTOM - 200; // Position above the UI bars
heart.visible = false;
// Keyboard controls - using LK event system instead of window
LK.on('keydown', function (event) {
if (gameState !== 'enemyTurn') return;
if (event.key === 'ArrowLeft') {
heart.isMovingLeft = true;
}
if (event.key === 'ArrowRight') {
heart.isMovingRight = true;
}
});
LK.on('keyup', function (event) {
if (gameState !== 'enemyTurn') return;
if (event.key === 'ArrowLeft') {
heart.isMovingLeft = false;
}
if (event.key === 'ArrowRight') {
heart.isMovingRight = false;
}
});
// Touch controls for mobile
game.move = function (x, y, obj) {
if (gameState === 'enemyTurn') {
// Move heart towards touch position
if (x < heart.x) {
heart.isMovingLeft = true;
heart.isMovingRight = false;
} else if (x > heart.x) {
heart.isMovingRight = true;
heart.isMovingLeft = false;
}
}
};
game.up = function (x, y, obj) {
if (gameState === 'enemyTurn') {
heart.isMovingLeft = false;
heart.isMovingRight = false;
}
};
// Game arrays and timers
var textAttacks = [];
var greenTextAttacks = [];
var attackTimer = 0;
var greenAttackTimer = 0;
var ansiedadTimer = 0;
var scoreTimer = 0;
// Player turn menu
var playerTurnMenu = null;
function showPlayerTurnMenu() {
if (playerTurnMenu) return; // Already showing
playerTurnMenu = game.addChild(new Container());
playerTurnMenu.x = 1024;
playerTurnMenu.y = 1800;
// Background
var menuBg = playerTurnMenu.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
menuBg.width = 900;
menuBg.height = 350;
menuBg.tint = 0x333333;
// Title
var title = playerTurnMenu.addChild(new Text2('Tu Turno - Técnicas de Tutoría', {
size: 40,
fill: 0xffffff
}));
title.anchor.set(0.5, 0.5);
title.y = -100;
// Technique buttons
var techniques = [{
text: 'Respiración Profunda',
effect: function effect() {
credibilidad += 20;
ansiedad = Math.max(0, ansiedad - 15);
enemy.takeDamage(15);
}
}, {
text: 'Palabras de Aliento',
effect: function effect() {
credibilidad += 25;
enemy.takeDamage(25);
}
}, {
text: 'Mindfulness',
effect: function effect() {
ansiedad = Math.max(0, ansiedad - 20);
enemy.takeDamage(20);
}
}];
for (var i = 0; i < techniques.length; i++) {
var btn = playerTurnMenu.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
btn.width = 280;
btn.height = 80;
btn.tint = 0x00aa00;
btn.x = (i - 1) * 250;
btn.y = 20;
btn.techniqueIndex = i;
var btnText = playerTurnMenu.addChild(new Text2(techniques[i].text, {
size: 28,
fill: 0xffffff
}));
btnText.anchor.set(0.5, 0.5);
btnText.x = btn.x;
btnText.y = btn.y;
btn.down = function () {
var technique = techniques[this.techniqueIndex];
technique.effect();
credibilidad = Math.min(100, credibilidad);
ansiedad = Math.max(0, ansiedad);
updateBars();
// Flash effect
tween(this, {
tint: 0xffffff
}, {
duration: 100,
onFinish: function onFinish() {
tween(this, {
tint: 0x00aa00
}, {
duration: 100
});
}
});
// End player turn and prepare for enemy turn
hidePlayerTurnMenu();
// Set a brief delay before enemy turn starts
LK.setTimeout(function () {
gameState = 'enemyTurn';
turnTimer = 0;
attacksLaunched = 0;
attackTimer = 0;
}, 500); // 500ms delay before enemy can start attacking
};
}
}
function hidePlayerTurnMenu() {
if (playerTurnMenu) {
playerTurnMenu.destroy();
playerTurnMenu = null;
}
}
// Main game update loop
game.update = function () {
// Only update game logic when in turn-based states
if (gameState !== 'enemyTurn' && gameState !== 'playerTurn') return;
// Allow heart movement during gameplay
if (gameState === 'enemyTurn' || gameState === 'playerTurn') {
heart.update();
}
// Turn-based system
if (gameState === 'enemyTurn') {
// Only allow enemy attacks if enemy is alive (visible)
if (enemy.visible) {
// Enemy's turn - launch attacks
turnTimer += 16.67; // Add frame time
attackTimer += 16.67;
// Launch attacks during enemy turn
var attackInterval = 1000; // Attack every 1000ms (1 second)
if (attackTimer >= attackInterval && attacksLaunched < ATTACKS_PER_TURN) {
var textAttack = new TextAttack();
textAttack.x = enemy.x + (Math.random() - 0.5) * 100;
textAttack.y = enemy.y + 50;
textAttacks.push(textAttack);
game.addChild(textAttack);
enemy.showAttackEffect();
attacksLaunched++;
attackTimer = 0;
}
// End enemy turn only when all attacks are launched AND all attacks are processed (hit or missed)
if (attacksLaunched >= ATTACKS_PER_TURN && textAttacks.length === 0) {
gameState = 'playerTurn';
turnTimer = 0;
// Show player turn interface
showPlayerTurnMenu();
}
}
} else if (gameState === 'playerTurn') {
// Player's turn - wait for player action or timeout
turnTimer += 16.67;
// Player turn ends only when technique is selected (handled in showPlayerTurnMenu)
// No automatic timeout - player must make a choice
}
// Update and check TextAttack collisions
for (var i = textAttacks.length - 1; i >= 0; i--) {
var atk = textAttacks[i];
// Check collision with heart
if (atk.intersects(heart)) {
heart.takeDamage(15);
ansiedad = Math.min(100, ansiedad + 15);
credibilidad = Math.max(0, credibilidad - 10);
updateBars();
atk.destroy();
textAttacks.splice(i, 1);
continue;
}
// Remove off-screen attacks
if (atk.y > GAME_BOTTOM + 100) {
atk.destroy();
textAttacks.splice(i, 1);
}
}
// Update and check GreenTextAttack collisions
for (var k = greenTextAttacks.length - 1; k >= 0; k--) {
var greenAtk = greenTextAttacks[k];
// Check collision with heart
if (greenAtk.intersects(heart)) {
credibilidad = Math.min(100, credibilidad + 8);
updateBars();
greenAtk.destroy();
greenTextAttacks.splice(k, 1);
continue;
}
// Remove off-screen green attacks
if (greenAtk.y > GAME_BOTTOM + 100) {
greenAtk.destroy();
greenTextAttacks.splice(k, 1);
}
}
// Check game over
if (ansiedad >= 100) {
LK.showGameOver();
}
// Check win condition
if (level >= maxLevel && credibilidad >= WIN_CRED) {
LK.showYouWin();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -201,10 +201,10 @@
var bg = self.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
- bg.width = 600;
- bg.height = 400;
+ bg.width = 700;
+ bg.height = 480;
bg.tint = 0x333333;
// Title
var title = self.addChild(new Text2('Técnica de Relajación', {
size: 48,
@@ -402,10 +402,10 @@
var dialogueBg = dialogueContainer.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0
}));
- dialogueBg.width = 1800;
- dialogueBg.height = 200;
+ dialogueBg.width = 1900;
+ dialogueBg.height = 280;
dialogueBg.tint = 0x333333;
dialogueBg.x = 1024;
dialogueBg.y = 180;
// Dialogue text
@@ -420,10 +420,10 @@
var continueBtn = dialogueContainer.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
- continueBtn.width = 300;
- continueBtn.height = 80;
+ continueBtn.width = 380;
+ continueBtn.height = 100;
continueBtn.tint = 0x00aa00;
continueBtn.x = 1024;
continueBtn.y = 410;
var continueText = dialogueContainer.addChild(new Text2('Continuar', {
@@ -461,8 +461,10 @@
var playButton = menuContainer.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
+playButton.width = 500;
+playButton.height = 150;
playButton.x = 2048 / 2;
playButton.y = 2732 / 2 + 100;
// Play button text
var playText = menuContainer.addChild(new Text2('JUGAR', {
@@ -560,10 +562,10 @@
var menuBg = playerTurnMenu.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
- menuBg.width = 800;
- menuBg.height = 300;
+ menuBg.width = 900;
+ menuBg.height = 350;
menuBg.tint = 0x333333;
// Title
var title = playerTurnMenu.addChild(new Text2('Tu Turno - Técnicas de Tutoría', {
size: 40,
@@ -596,10 +598,10 @@
var btn = playerTurnMenu.addChild(LK.getAsset('playButton', {
anchorX: 0.5,
anchorY: 0.5
}));
- btn.width = 220;
- btn.height = 60;
+ btn.width = 280;
+ btn.height = 80;
btn.tint = 0x00aa00;
btn.x = (i - 1) * 250;
btn.y = 20;
btn.techniqueIndex = i;