Code edit (2 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
The first turn of the game should be turn 1 not turn 0.
Code edit (2 edits merged)
Please save this source code
User prompt
The turn counter text should have a black outline with a stroke thickness of 10.
User prompt
When a character poisons another character, the character being poisoned should be the one that highlights purple.
Code edit (2 edits merged)
Please save this source code
User prompt
Add thick white outlines to the Boss Health text and the Hero Health text.
User prompt
place the statWindow asset underneath the Boss Health value.
User prompt
Place the statWindow asset underneath boss health and hero health.
User prompt
Place the statWindow asset underneath the boss health and hero health values.
User prompt
Place the youWin asset on top of the hero whenever the player wins the game.
User prompt
Place the youLose asset on top of the hero when the player loses the game.
User prompt
The entire screen should turn green if the player wins.
User prompt
The entire screen should turn red when the player loses.
User prompt
There should be a "You Win" screen with the option to replay if the boss's health is <= 0 and the turn count is below 11.
User prompt
Please fix the bug: 'TypeError: LK.showVictory is not a function' in or related to this line: 'LK.showVictory();' Line Number: 160
User prompt
The player should win if the boss's health is <= 0 and the turn count is below 11.
Code edit (1 edits merged)
Please save this source code
User prompt
After the player presses the sword, poison vial, or health potion button the end turn button should be highlighted until it is pressed.
/**** * Classes ****/ var Boss = Container.expand(function () { var self = Container.call(this); self.heal = function () { var healAmount = Math.floor(Math.random() * (30 - 15 + 1)) + 15; self.health += healAmount; LK.effects.flashObject(self, 0x00ff00, 1000); if (self.health <= 0) { LK.showGameOver(); return; } }; self.attack = function (target) { target.health -= 20; LK.effects.flashObject(target, 0xff0000, 1000); }; self.applyPoison = function () { self.poisoned++; LK.effects.flashObject(self, 0x800080, 1000); }; self.health = 300; self.poisoned = 0; self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); self.takeDamage = function (amount) { self.health -= 30 * (1 + 0.1 * self.poisoned); LK.effects.flashObject(self, 0xff0000, 1000); }; }); var HealthPotion = Container.expand(function () { var self = Container.call(this); self.attachAsset('healthPotion', { anchorX: 0.5, anchorY: 0.5 }); }); var Hero = Container.expand(function () { var self = Container.call(this); self.health = 100; self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.attack = function (target) { target.health -= 60; LK.effects.flashObject(target, 0xff0000, 1000); }; self.heal = function () { var healAmount = Math.floor(Math.random() * (30 - 15 + 1)) + 15; self.health += healAmount; LK.effects.flashObject(self, 0x00ff00, 1000); if (self.health <= 0) { LK.showGameOver(); } }; self.applyPoison = function (target) { target.applyPoison(); LK.effects.flashObject(target, 0x800080, 1000); }; }); var PoisonVial = Container.expand(function () { var self = Container.call(this); self.attachAsset('poisonVial', { anchorX: 0.5, anchorY: 0.5 }); }); var Sword = Container.expand(function () { var self = Container.call(this); self.attachAsset('sword', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game(); /**** * Game Code ****/ var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5 })); background.x = 1024; background.y = 1366; // Initialize assets for the game var poisonVialButton = game.addChild(new PoisonVial()); poisonVialButton.x = 1548; poisonVialButton.y = 2732 - 200; poisonVialButton.interactive = true; poisonVialButton.on('down', function () { if (!actionTaken) { hero.applyPoison(boss); bossHealthText.setText('Boss Health: ' + boss.health); actionTaken = true; endTurnButton.tint = 0x00ff00; } }); var healthPotionButton = game.addChild(new HealthPotion()); healthPotionButton.x = 1800; healthPotionButton.y = 2732 - 200; healthPotionButton.interactive = true; var actionTaken = false; healthPotionButton.on('down', function () { if (!actionTaken) { hero.heal(); heroHealthText.setText('Hero Health: ' + hero.health); actionTaken = true; endTurnButton.tint = 0x00ff00; } }); var swordButton = game.addChild(new Sword()); swordButton.x = 500; swordButton.y = 2732 - 200; swordButton.interactive = true; swordButton.on('down', function () { if (!actionTaken) { hero.attack(boss); bossHealthText.setText('Boss Health: ' + boss.health); actionTaken = true; endTurnButton.tint = 0x00ff00; } }); var endTurnButton = game.addChild(new LK.getAsset('endTurnButtonArrow', { anchorX: 0.5, anchorY: 0.5 })); LK.gui.right.addChild(endTurnButton); endTurnButton.y = 200; endTurnButton.x = -200; endTurnButton.interactive = true; endTurnButton.on('down', function () { turns++; turnText.setText('Turn: ' + turns); actionTaken = false; endTurnButton.tint = 0xffffff; if (turns >= 11 && boss.health > 0) { LK.showGameOver(); } if (boss.health <= 0 && turns < 11) { LK.showGameOver('You Win'); } var bossAction = Math.floor(Math.random() * 3); switch (bossAction) { case 0: boss.heal(); bossHealthText.setText('Boss Health: ' + boss.health); break; case 1: boss.attack(hero); heroHealthText.setText('Hero Health: ' + hero.health); break; case 2: boss.applyPoison(hero); break; } }); var turnText = new Text2('Turn: 0', { size: 50, fill: '#ffffff' }); LK.gui.top.addChild(turnText); turnText.x = 200; var heroHealthText = new Text2('Hero Health: 100', { size: 50, fill: '#00ff00' }); LK.gui.left.addChild(heroHealthText); var bossHealthText = new Text2('Boss Health: 300', { size: 50, fill: '#ff0000' }); LK.gui.left.addChild(bossHealthText); bossHealthText.y = heroHealthText.y - 150; var hero = game.addChild(new Hero()); hero.x = 1024; // Center horizontally hero.y = 2732 - 200; // Position at the bottom var boss = game.addChild(new Boss()); boss.x = 1024; // Center horizontally boss.y = 200; // Position at the top var turns = 0; var maxTurns = 10; // Game logic LK.on('tick', function () { // Game logic to be executed every frame // This example does not include the full game logic, which would handle turns, attacks, and game over conditions. }); // Example of handling a touch event to attack // This is a simplified example. The actual game would need more detailed logic for handling attacks, healing, poison effects, and determining the game's end.
===================================================================
--- original.js
+++ change.js
@@ -145,9 +145,9 @@
if (turns >= 11 && boss.health > 0) {
LK.showGameOver();
}
if (boss.health <= 0 && turns < 11) {
- LK.showGameOver();
+ LK.showGameOver('You Win');
}
var bossAction = Math.floor(Math.random() * 3);
switch (bossAction) {
case 0:
Heroic wizard knight wearing knight armor with a star pattern and wielding a sword.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Health potion button.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Poison vial button.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Golden glittery magic sword button.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Giant muscular evil wizard with purple skin and a menacing scowl sitting in a black throne.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A glowing horizontal arrow button that says "End Turn".. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Background seen from above showing the long vertical black throne room hallway of the dark wizard king.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"You Lose" written in blood.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"You Win" written in glittering holy golden light.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Empty futuristic black application window box.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.